Skip to content

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

Merged
methane merged 2 commits into
python:masterfrom
methane:dict-resize
Apr 17, 2018
Merged

bpo-33205: dict: Change GROWTH_RATE to (used*3)#6350
methane merged 2 commits into
python:masterfrom
methane:dict-resize

Conversation

@methane

@methane methane commented Apr 2, 2018

Copy link
Copy Markdown
Member

@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
Copy Markdown
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.

Comment thread Objects/dictobject.c Outdated
* 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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