-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Open
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage
Description
Current layout
Currently the _dictkeysobject struct is laid out like this:
ptr ----> +--------------+
| header |
+--------------+
| indices |
+--------------+
| keys |
+--------------+
which requires some relatively expensive calculation to find the start of the keys, as the indices are not only variable in number, but variable in size also.
Proposed layout
If instead it is laid out as follows:
+--------------+
| indices |
ptr ----> +--------------+
| header |
+--------------+
| keys |
+--------------+
and the indices laid from highest to lowest with 0 just before ptr, finding the start of the keys is as simple as ptr->keys . Accessing an index is no slower, and the code barely any more complex.
gpsheadstonebig and CarlosEduR
Metadata
Metadata
Assignees
Labels
3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage