You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pre-allocate version numbers for common builtin classes. #126547
We use the tp_version field of class objects for quite a few of our optimizations, so it gets set for almost classes.
If we pre-allocate the version for common classes, like int, float, tuple, etc, then we can use the version number to speedup dispatching by class in a few cases:
Examples:
BIN_OP and COMPARE_OP specialization for common-ish types like int + float
Specialization of other ops like COMPARE_OP
Reducing the overhead of traversing objects in the garbage collector
Possible performance improvements to marshal and pickle.
We could add these version numbers when implementing any of the above the features, but I'm proposing adding separately to keep the size of the PR down and easier to review
Activity
GH-126547: Pre-assign version numbers for a few common classes (GH-12…
pythonGH-126547: Pre-assign version numbers for a few common classes (p…
pythonGH-126547: Pre-assign version numbers for a few common classes (p…
gh-126547: pre-allocate version number for unicode type (#157781)
[3.15] gh-126547: pre-allocate version number for unicode type (GH-15…