[Python] - Improve Model Deserialization Perf - #11704
Closed
Kashif Khan (kashifkhan) wants to merge 2 commits into
Closed
[Python] - Improve Model Deserialization Perf#11704Kashif Khan (kashifkhan) wants to merge 2 commits into
Kashif Khan (kashifkhan) wants to merge 2 commits into
Conversation
commit: |
Contributor
|
❌ There is undocummented changes. Run The following packages have changes but are not documented.
Show changes |
|
You can try these changes here
|
Member
Author
|
new branch here #11705 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR focusses on improving the performance of the deserialization path of python generated files. I wanted to focus on a couple areas where speed ups could be done and see some results
_serialize. Things likeint,float,list[str]don't need to be serialized. Store them as is and work on things that need itList[Pet],Optional[datetime]) means walking typing internals, and the answer never changes for a given type, so it's cached.On a ~5.6 MB DocumentIntelligence-shaped (why I started this) response on Python 3.10:
• Building the model tree: ~2.7× faster (~880 ms dropped to ~330 ms)
• Build + read every field: roughly halved (~2.0 s dropped to ~1.15 s)