4 ms·
Python-3.13 is more than 100% slower with –disable-gil
Python-3.13.0b3 is over 100% slower with --disable-gil compared to --enable-gil.
Benchmark:
sum = 0.0
def f():
global sum
for i in range(10000):
for j in range(10000):
sum += i*j
return sum
print(f())
Build A: ./configure --enable-gil: 8 seconds
Build B: ./configure --disable-gil: 20 seconds
- rbanffy 2y agoWon't this be the almost worst possible case imaginable for this?
- lambdaone 2y agoAbsolutely. Global variables are always going to need some sort of arbitration mechanism, and this is doing it in the innermost loop. Even if there's only one thread, something needs to find that out. I'm surprised it's only half the speed.
- lakrman 2y agoNo, with sum moved into the function I get 6s for --enable-gil and 15.5s for --disable-gil on my machine, which is in the same order. As an added bonus, the stock Debian Python 3.7 is faster than both versions. So the alleged "faster python" promises are not kept, and neither are the "at most 15% slowdown" promises for the no-gil project.
- rbanffy 2y agoWould be worthwhile to run something more significant, maybe pybench.
- HAKSH 2y agoThis benchmark shows abysmal numbers, no need to run a bloated test suite that is so large and convoluted that no one understands what is being measured.
- rbanffy 2y agoA test that shows a worst possible scenario is not a benchmark, not an accurate reflection of what users will experience.