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

gh-124218: Use per-thread reference counting for globals and builtins #125713

Merged
merged 3 commits into from
Oct 21, 2024

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Oct 18, 2024

Use per-thread refcounting for the reference from function objects to the globals and builtins dictionaries.

There's still one remaining bottleneck in _PyEval_BuiltinsFromGlobals, which temporarily modifies the bulitins dictionary reference count before returning a borrowed reference.

…iltins

Use per-thread refcounting for the reference from function objects to
the globals and builtins dictionaries.
Include/internal/pycore_dict.h Outdated Show resolved Hide resolved
Include/internal/pycore_dict.h Outdated Show resolved Hide resolved
Include/internal/pycore_dict.h Show resolved Hide resolved
Python/uniqueid.c Outdated Show resolved Hide resolved
* Add some code comments about _Py_INCREF_TYPE/CODE/DICT
* Fix typo
* Move size check to `_PyDict_EnablePerThreadRefcounting`
@colesbury colesbury merged commit 9b0bfba into python:main Oct 21, 2024
36 checks passed
@colesbury colesbury deleted the gh-124218-thread-refcount-dict branch October 21, 2024 16:51
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
…iltins (python#125713)

Use per-thread refcounting for the reference from function objects to
the globals and builtins dictionaries.
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.

3 participants