New submission from Xinhang Xu <xuxinhang4...@126.com>:
Hello. I'm working on a compute-bound project recently, so I tested several Python versions on my PC (Windows 10 64-bit), about Python's performance on operating Int object. All Python binaries are official distributions. Testcase #1 (simple xor op) Source: import cProfile as profile profile.run('for _ in range(500000000): 5 ^ 6') The given result: C:\Users\surface\Desktop\PythonTest>python-3.9.9-embed-amd64\python C:\Users\surface\python_test.py 3 function calls in 24.398 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 24.398 24.398 24.398 24.398 <string>:1(<module>) 1 0.000 0.000 24.398 24.398 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} C:\Users\surface\Desktop\PythonTest>python-3.10.0-embed-amd64\python C:\Users\surface\python_test.py 3 function calls in 27.941 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 27.941 27.941 27.941 27.941 <string>:1(<module>) 1 0.000 0.000 27.941 27.941 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} C:\Users\surface\Desktop\PythonTest>python-3.11.0a2-embed-amd64\python C:\Users\surface\python_test.py 3 function calls in 42.209 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 42.209 42.209 42.209 42.209 <string>:1(<module>) 1 0.000 0.000 42.209 42.209 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} Testcase #2 (simple add op) Source: import cProfile as profile profile.run('for _ in range(500000000): 5 + 6') The given result: C:\Users\surface\Desktop\PythonTest>python-3.9.9-embed-amd64\python C:\Users\surface\python_test.py 3 function calls in 24.599 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 24.599 24.599 24.599 24.599 <string>:1(<module>) 1 0.000 0.000 24.599 24.599 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} C:\Users\surface\Desktop\PythonTest>python-3.10.0-embed-amd64\python C:\Users\surface\python_test.py 3 function calls in 27.414 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 27.414 27.414 27.414 27.414 <string>:1(<module>) 1 0.000 0.000 27.414 27.414 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} C:\Users\surface\Desktop\PythonTest>python-3.11.0a2-embed-amd64\python C:\Users\surface\python_test.py 3 function calls in 43.675 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 43.675 43.675 43.675 43.675 <string>:1(<module>) 1 0.000 0.000 43.675 43.675 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} As you can see, Python 3.11 costs *much more* time to execute Int object operator. I have also tested the same cases on another Windows PC, the result shows the same. Is it a common thing? What's the reason for this problem? Thanks. ---------- messages: 406849 nosy: xuxinhang priority: normal severity: normal status: open title: Performance regression of Int object operators. (Python 3.11) type: performance versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45880> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com