Skip to content

Conversation

@arun-geek
Copy link

@arun-geek arun-geek commented Oct 26, 2025

Refactoring to improve efficiency of the code

create a items tuple by combining first_items with extra_items and is not used in the reminder of the code. To make it more efficient we can check the items directly

create a items tuple by combining first_items with extra_items and is not used in the reminder of the code.
To make it more efficient we can check the items directly
@arun-geek arun-geek changed the title perf: Avoid creating an intermediate container refactor: Avoid creating an intermediate container for efficiency Oct 26, 2025
@arun-geek arun-geek marked this pull request as draft October 26, 2025 19:19
@arun-geek arun-geek marked this pull request as ready for review October 26, 2025 19:21
Copy link
Member

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arun-geek, thanks for your interest!

It was probably made this way to reduce the code duplication (if not isinstance(first_item, DefaultPlaceholder)).
The performance impact of this change is very tiny - this function is only called several times per route on application startup.

I don't think we should focus on such micro-optimizations, but let's Sebastian decide.

@YuriiMotov YuriiMotov changed the title refactor: Avoid creating an intermediate container for efficiency ♻️ Avoid creating an intermediate container in get_value_or_default for efficiency Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants