Nuitka makes plus and minus much slower
See original GitHub issueI’ve tried to compile a performance test using nuitka 0.6.13rc2 in order to again investigate in what extent can Nuitka speed up a python program. It showed Nuitka made the plus and minus operation 15%~20% slower than before, but Nuitka also speed up multiply operation about 60% that’s incredible! Besides, I’m also curious about using which compiler would make program faster msvc or mingw64?
Platform: Windows CPU: Ryzen7 1700 RAM: DDR4-3200*2 Python: 3.8.7 (x64) Nuitka: 0.6.13rc2
Before:
Compiler command (msvc):
nuitka --msvc=MSVC --windows-disable-console --standalone --show-progress --output-dir=C:\Users\home\Desktop\1 C:\Users\home\PycharmProjects\speedtest\venv\main.py
Compiler command (mingw64):
nuitka --mingw64 --windows-disable-console --standalone --show-progress --output-dir=C:\Users\home\Desktop\1 C:\Users\home\PycharmProjects\speedtest\venv\main.py
Code:
import time
import os
def plus():
a = 0
for x in range(100000000):
a += 1
def minus():
a = 100000000
for x in range(100000000):
a -= 1
def multiply():
a = 1
for x in range(100000000):
a *= 1.00000003
def divide():
a = 1000000000
for x in range(100000000):
a /= 1.00000003
if __name__ == '__main__':
s = time.time()
plus()
e = time.time()
print('Plus:',round(100000000/(e-s)/1000000,2),'M/s')
s = time.time()
minus()
e = time.time()
print('Minus:',round(100000000/(e-s)/1000000,2),'M/s')
s = time.time()
multiply()
e = time.time()
print('Multiply:',round(100000000/(e-s)/1000000,2),'M/s')
s = time.time()
divide()
e = time.time()
print('Divide:',round(100000000/(e-s)/1000000,2),'M/s')
os.system('pause')
Issue Analytics
- State:
- Created 3 years ago
- Comments:35 (30 by maintainers)
Part of the 0.6.13 release.
Appyling the lessons learned to binary operations for consistency also, is for 0.6.14. I will keep this open, because I want to work on the other things mentioned in that cycle potentially too.
The improvement for 3.9 makes this about 20% faster. For 0.6.16 we will see what Nuitka Python can do. With static linking rather than DLL linkage, I expect a huge gain again.