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

Replace dict.get and dict.setdefault with more verbose versions in CoreSchema building hot paths #7536

Merged
merged 1 commit into from Sep 21, 2023

Conversation

adriangb
Copy link
Member

@adriangb adriangb commented Sep 21, 2023

I've benchmarked this to be slightly faster. Some of these, especially the ones during walking of core schemas, get hit a lot.

Selected Reviewer: @Kludex

@adriangb
Copy link
Member Author

please review

@cloudflare-pages
Copy link

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 72e50b8
Status: ✅  Deploy successful!
Preview URL: https://79fdbc3a.pydantic-docs2.pages.dev
Branch Preview URL: https://optimize-schema-building-dic.pydantic-docs2.pages.dev

View logs

@adriangb adriangb enabled auto-merge (squash) September 21, 2023 05:19
@adriangb adriangb merged commit 198c8c6 into main Sep 21, 2023
50 checks passed
@adriangb adriangb deleted the optimize-schema-building-dict-operations branch September 21, 2023 12:25
@davidhewitt davidhewitt added the relnotes-performance Used for performance improvements. label Sep 21, 2023
@whisller
Copy link

@adriangb would you be able to include those benchmarks please? I am curious what was the difference in both approaches

@adriangb
Copy link
Member Author

Very minor. Mainly creating a new empty dict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review relnotes-performance Used for performance improvements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants