← 返回首页
bpo-40521: Remove freelist from collections.deque() by rhettinger · Pull Request #21073 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

bpo-40521: Remove freelist from collections.deque()#21073

Merged
rhettinger merged 1 commit into
python:masterfrom
rhettinger:deque_freelist
Jun 23, 2020
Merged

bpo-40521: Remove freelist from collections.deque()#21073
rhettinger merged 1 commit into
python:masterfrom
rhettinger:deque_freelist

Conversation

rhettinger commented Jun 23, 2020
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

vstinner left a comment

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

LGTM.

But I'm curious, why removing it? The free list is not longer faster than always calling PyMem_Malloc/PyMem_Free?

Previously, PyMem_Malloc/PyMem_Free called libc malloc/free. But now it's the pymalloc memory allocator which is faster than libc allocator for small memory allocation (up to 512 bytes). Maybe pymalloc made the free list less interesting?

Copy link
Copy Markdown
Contributor Author

Deques only call the allocator once every 64 updates, so the average cost is small.

rhettinger merged commit 32f2eda into python:master Jun 23, 2020
fasih pushed a commit to fasih/cpython that referenced this pull request Jun 29, 2020
rhettinger added a commit to rhettinger/cpython that referenced this pull request Mar 20, 2021
…-21073)" This reverts commit 32f2eda. It can be re-applied if the subinterpreter PEP is approved. Otherwise, the commit degraded performance with no offsetting benefit.
rhettinger added a commit that referenced this pull request Mar 25, 2021
…" (GH-24944) This reverts commit 32f2eda. It can be re-applied if the subinterpreter PEP is approved. Otherwise, the commit degraded performance with no offsetting benefit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.