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

Simplify internal generics logic - remove generator overhead #10059

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

sydney-runkle
Copy link
Member

@sydney-runkle sydney-runkle commented Aug 6, 2024

Reduce generator overhead in recursive calls by using simple for loops - improves this has_instance_in_type function by 20%, resulting in a 1% speedup globally.

Continuing to chip away 1% by 1%.

@sydney-runkle sydney-runkle added the relnotes-performance Used for performance improvements. label Aug 6, 2024
Copy link

cloudflare-workers-and-pages bot commented Aug 6, 2024

Deploying pydantic-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: b7a8605
Status: ✅  Deploy successful!
Preview URL: https://d4a8412b.pydantic-docs.pages.dev
Branch Preview URL: https://generics-speedup.pydantic-docs.pages.dev

View logs

Copy link

codspeed-hq bot commented Aug 6, 2024

CodSpeed Performance Report

Merging #10059 will not alter performance

Comparing generics-speedup (b7a8605) with main (7e3c169)

Summary

✅ 17 untouched benchmarks

@sydney-runkle sydney-runkle changed the title Draft: potentially speeding up internal generics logic Improve internal generics logic Aug 6, 2024
@sydney-runkle sydney-runkle changed the title Improve internal generics logic Simplify internal generics logic - remove generator overhead Aug 6, 2024
Copy link
Contributor

github-actions bot commented Aug 6, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  pydantic/_internal
  _generics.py
Project Total  

This report was generated by python-coverage-comment-action

@sydney-runkle sydney-runkle merged commit 5e241c6 into main Aug 6, 2024
61 checks passed
@sydney-runkle sydney-runkle deleted the generics-speedup branch August 6, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes-performance Used for performance improvements.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants