distribution icon indicating copy to clipboard operation
distribution copied to clipboard

Build `CPython` with `--disable-gil` and `--enable-experimental-jit=yes-off` for better performance.

Open hksdpc255 opened this issue 1 year ago • 3 comments

--disable-gil will allow python running in a free-threaded mode, allowing python to utilize multiple cpu core in a single process. This feature seems disabled by default thus not affecting the compatibility.

--enable-experimental-jit=yes-off will allow python running with JIT but disable it by default for compatibility reason.

hksdpc255 avatar Nov 08 '24 07:11 hksdpc255

The jit is going to have to wait until upstream python makes a release with llvm 19 support, it is upstreamed but I'm not up for backporting all the patches.

The gil change is trickier for a different reason, the change has negative performance impact for single threaded code (up to 40%) and memory size penalties that can be quite large for multithreaded code that are scheduled to be improved in 3.14. I'll try and do some benchmarking to compare but at this point I'm not inclined to enable it right now.

bryteise avatar Nov 08 '24 18:11 bryteise

Any update? Will the performance regression disappear when gil is manually enabled in a gil-disabled build?

hksdpc255 avatar Nov 27 '24 01:11 hksdpc255

3.13.1 is still not out so jit is still waiting.

I haven't had time to do performance testing yet.

bryteise avatar Nov 27 '24 05:11 bryteise