{{ message }}
bpo-46712: Share global string identifiers in deepfreeze#31261
Merged
gvanrossum merged 3 commits intopython:mainfrom Feb 25, 2022
Merged
bpo-46712: Share global string identifiers in deepfreeze#31261gvanrossum merged 3 commits intopython:mainfrom
gvanrossum merged 3 commits intopython:mainfrom
Conversation
a173ee9 to
3bd4e2a
Compare
Member
ericsnowcurrently
added a commit
that referenced
this pull request
Feb 15, 2022
Instead of manually enumerating the global strings in generate_global_objects.py, we extrapolate the list from usage of _Py_ID() and _Py_STR() in the source files. This is partly inspired by gh-31261. https://bugs.python.org/issue46541
Member
|
@kumaraditya303 Could you fix the conflicts? |
470037f to
e959ed6
Compare
Contributor
Author
Fixed |
Contributor
Author
|
@gvanrossum This is ready for review. |
gvanrossum
approved these changes
Feb 25, 2022
Member
gvanrossum
left a comment
There was a problem hiding this comment.
LGTM.
I looked at some of the generated output and this feels like it's a good improvement.
gvanrossum
approved these changes
Feb 25, 2022
Member
gvanrossum
left a comment
There was a problem hiding this comment.
Thanks. Waiting for the tests to run once more.
(Also, please go fix the interning error handling, even if you disagree.)
Contributor
Author
Okay, will create a PR tomorrow. |
Member
asvetlov
pushed a commit
that referenced
this pull request
Feb 26, 2022
Where appropriate, deepfreeze.c now uses `&_Py_ID(blah)` references instead of locally defining constants. This saves some space.
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.

Since bpo-46541, the global strings are statically allocated so they can now be referenced by deep-frozen modules just like any other singleton. Sharing identifiers with deepfreeze will reduce the duplicated strings hence it would save space.
See faster-cpython/ideas#218
See faster-cpython/ideas#230
https://bugs.python.org/issue46712