-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
try moving definition inlining to pydantic-core #12294
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
base: main
Are you sure you want to change the base?
Conversation
Deploying pydantic-docs with
|
| Latest commit: |
5da3807
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5842a178.pydantic-docs.pages.dev |
| Branch Preview URL: | https://dh-core-inline-definitions.pydantic-docs.pages.dev |
CodSpeed Performance ReportMerging #12294 will degrade performances by 5.67%Comparing Summary
Benchmarks breakdown
|
|
cc @Viicos this implements a first step in what I proposed by moving schema inlining to Rust. It seems like this is currently a decent win ~10%, however it could change a lot depending on what we can do with schema caching and config schema etc |
|
(serialization slowdown is because serializers don't inline in Rust yet on the draft core branch, also a few small test failures is not a surprise, these are mostly from asserting the schema type, which has changed, and also from a few changes to recursion handling which I think I can trivially prevent in core) |
Change Summary
This is an experiment to see what happens if definition inlining is implemented inside
SchemaValidator. This should avoid the need to do it in Python (in theclean_schemafunction).Hoping this has performance benefits.
Not fully implemented yet, there's some test diffs due to changes in the recursion defenses, I think I know how to resolve.
For now I haven't particularly changed the Python code, just made
GenerateSchemanot bother running cleaning if there are no deferred discriminators to apply.Related issue number
N/A
Checklist