Skip to content

Revert "bpo-40521: Remove freelist from collections.deque() (GH-21073)" #24944

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

Merged
merged 1 commit into from
Mar 25, 2021

Conversation

rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Mar 20, 2021

This reverts commit 32f2eda.
It can be re-applied if the subinterpreters PEP is approved.
Otherwise, the commit degraded performance with no offsetting
benefit.

https://bugs.python.org/issue40521

…-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.
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

It can be re-applied if the subinterpreters PEP is approved.

subinterpreters exist for years and are used by multiple projects. The recent work is to make more code compatible with subinterpreters (make the code "correct"), only a small part of the work is really specific to preparing CPython code base for running multiple interpreters in parallel.


#define MAXFREEBLOCKS 16
static Py_ssize_t numfreeblocks = 0;
static block *freeblocks[MAXFREEBLOCKS];
Copy link
Member

Choose a reason for hiding this comment

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

Can you define the freelist in PyInterpreterState to make it per-interpreter, and so compatible with subinterpreters?

Copy link
Contributor Author

@rhettinger rhettinger Mar 20, 2021

Choose a reason for hiding this comment

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

The subinterpreters PEP is not approved a likely won't be for Python 3.10, so I don't want to pay that cost now. These macros are used heavily throughout the rest of the module and are performance sensitive. For Python 3.11 and later, this can be reapplied. Even then, it would probably be better to remove the freelists entirely than to add fenced logic to get the current interpreter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants