-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Closed
Labels
3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage
Description
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_OPandCOMPARE_OPspecialization for common-ish types likeint + 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
Linked PRs
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage