Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small optimization in find_annotated_strategy #3980

Closed
Viicos opened this issue May 10, 2024 · 1 comment · Fixed by #3986
Closed

Small optimization in find_annotated_strategy #3980

Viicos opened this issue May 10, 2024 · 1 comment · Fixed by #3986
Labels
performance go faster! use less memory!

Comments

@Viicos
Copy link
Contributor

Viicos commented May 10, 2024

Currently working on the Pydantic hypothesis plugin, figured the following could be optimized a bit:

for constraint in _get_constraints(metadata):
if convert := get_constraints_filter_map().get(type(constraint)):
filter_conditions.append(convert(constraint))
else:
unsupported.append(constraint)

By building the filter map once before the for loop. If you agree, PR ready to be pushed.

@Zac-HD
Copy link
Member

Zac-HD commented May 10, 2024

Yes please!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance go faster! use less memory!
Projects
None yet
2 participants