Repository navigation
gh-150865: Add PyUnstable_Immortalize - #160138
ZeroIntensity wants to merge 9 commits into
Conversation
Documentation build overview
11 files changed ·
|
It's really slow under TSan so it times out.
|
Hi @ZeroIntensity thank you for the PR. Immortal types are fixing the free-threaded slowdown for both PRs numpy/numpy/pull/32853 and numpy/numpy/pull/32552 about as well as the Benchmarks: numpy/numpy/pull/32853 types (
numpy/numpy/pull/32552 types (neighborhood iterator, MapIter), free-threaded, million calls/s**
GIL build, one thread, ns per call (lower is better)
|
|
@ZeroIntensity wasn't there another approach you were thinking about for this? |
|
Per our discussion during the sprint, I think we reached a consensus that NumPy can use static types for things it would otherwise immortalize, right? As far as I can tell, it should be possible to share third-party static types across interpreters; the only requirement for subinterpreters is to use multi-phase initialization, which doesn't disallow static types. (If you find bugs with that, we should fix those!) |
|
@prathamhole14 @mattip does that work for you two? |
|
As far as I know, static types are incompatible with the limited API. If CPython wishes to allow c-extension authors to support subinterpreters, free-threading, and the limited API in a performant way, I think we need to be able to declare heap types immutable and immortal. |
|
The limited API already has performance problems (all the |
Largely based on my old implementation for 3.14.
PyUnstable_SetImmortalto objects allocated in that thread? #150865