Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-33205: dict: Change GROWTH_RATE to (used*3) #6350

Merged
merged 2 commits into from
Apr 17, 2018

Conversation

methane
Copy link
Member

@methane methane commented Apr 2, 2018

@methane methane added performance Performance or resource usage needs backport to 3.7 labels Apr 2, 2018
@methane methane changed the title bpo-33205: dict: Change GROWTH_RATE from (used*2 + capacity/2) to (used*3) bpo-33205: dict: Change GROWTH_RATE to (used*3) Apr 2, 2018
@@ -0,0 +1,2 @@
Change dict growth function from ``round_up_to_power_2(used*2+capacity/2)`` to ``round_up_to_power_2(used*3)``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use "hashtable_size" instead if "capacity". The capacity is only 2/3 of the hashtable size.

* This means that dicts double in size when growing without deletions,
* but have more head room when the number of deletions is on a par with the
* number of insertions.
* number of insertions. See also bpo-17563 and bpo-33205.
* Raising this to used*4 doubles memory consumption depending on the size of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this note still relevant?

@methane methane merged commit 5fbc511 into python:master Apr 17, 2018
@miss-islington
Copy link
Contributor

Thanks @methane for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@methane methane deleted the dict-resize branch April 17, 2018 06:53
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Apr 17, 2018
(cherry picked from commit 5fbc511)

Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
@bedevere-bot
Copy link

GH-6503 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Apr 17, 2018
(cherry picked from commit 5fbc511)

Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants