Skip to content

refactor(ddgs): improve extract performance#467

Merged
deedy5 merged 1 commit into
deedy5:mainfrom
Mizarka:fastresult
May 23, 2026
Merged

refactor(ddgs): improve extract performance#467
deedy5 merged 1 commit into
deedy5:mainfrom
Mizarka:fastresult

Conversation

@Mizarka

@Mizarka Mizarka commented May 20, 2026

Copy link
Copy Markdown
Contributor

The previous map-based approach, while prettier-looking, caused Python to eagerly calculate all possible return formats to insert on the map, only to discard most and keep only one.

The new, slightly longer if-based approach only accesses a single format attribute, calculating only one.

getattr(resp, fmt) was considered but that may result in complications due to reflection (eg missing reference errors if a method is renamed in the upstream primp)

The previous map-based approach, while prettier-looking, caused Python
to eagerly calculate all possible return formats to insert on the map,
only to discard most and keep only one.

The new, slightly longer if-based approach only accesses a single
format attribute, calculating only one.
@deedy5
deedy5 merged commit a12929a into deedy5:main May 23, 2026
6 checks passed
@deedy5

deedy5 commented May 23, 2026

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants