Skip to content

Comments

gh-142889: Restructure PyDictKeysObject memory layout for simpler access#145097

Open
clintonsteiner wants to merge 3 commits intopython:mainfrom
clintonsteiner:gh-142889
Open

gh-142889: Restructure PyDictKeysObject memory layout for simpler access#145097
clintonsteiner wants to merge 3 commits intopython:mainfrom
clintonsteiner:gh-142889

Conversation

@clintonsteiner
Copy link

@clintonsteiner clintonsteiner commented Feb 22, 2026

Restructure dict keys allocation to store dk_indices before the PyDictKeysObject header and keep dk_entries after the header.

Update dict index access and related allocation/free/clone paths, adjust gdb dict entry location logic, and add layout coverage tests.

Local dict microbenchmarks showed about a 1.4% overall improvement, with most operations around 1-2% faster.

@python-cla-bot
Copy link

python-cla-bot bot commented Feb 22, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

…er entry access

Restructure dict keys allocation to store dk_indices before the PyDictKeysObject header and keep dk_entries after the header.

Update dict index access and related allocation/free/clone paths, adjust gdb dict entry location logic, and add layout coverage tests.

Local dict microbenchmarks showed about a 1.4% overall improvement, with most operations around 1-2% faster.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant