Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.2k
Improve annotation application performance#11186
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Also remove unnecessary schema copy.
Deploying pydantic-docs with |
Latest commit: | d285728 |
Status: | ✅ Deploy successful! |
Preview URL: | https://d7bfb8e4.pydantic-docs.pages.dev |
Branch Preview URL: | https://ann-application-perf-test.pydantic-docs.pages.dev |
CodSpeed Performance ReportMerging#11186 willimprove performances by 7.02%Comparing Summary
Benchmarks breakdown
|
Coverage reportClick to see where and how coverage changed
This report was generated bypython-coverage-comment-action |
@@ -2106,7 +2106,7 @@ def _apply_single_annotation(self, schema: core_schema.CoreSchema, metadata: Any | |||
return self.defs.definitions[new_ref] | |||
schema['ref'] = new_ref # type: ignore | |||
maybe_updated_schema = _known_annotated_metadata.apply_known_metadata(metadata, schema.copy()) | |||
maybe_updated_schema = _known_annotated_metadata.apply_known_metadata(metadata, schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
apply_known_metadata
already copiesschema
schema = get_inner_schema(source) | ||
schema = self._apply_single_annotation(schema, annotation) | ||
schema = self._apply_single_annotation_json_schema(schema, annotation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This way, we don't go through_appy_single_annotation*
for annotations with a custom__get_pydantic_core_schema__
as it is unnecessary.
Viicos commentedDec 29, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Great find, thanks for making reviewing the perf diff easy!
Just as a side note, I think there's still a lot to do with#10036, I'm happy to take a deeper look at this for v2.11 :) |
7b7db4f
intomainUh oh!
There was an error while loading.Please reload this page.
Also remove unnecessary schema copy.
Change Summary
Related issue number
Checklist