[New-bugs-announce] [issue45880] Performance regression of Int object operators. (Python 3.11)
Xinhang Xu
report at bugs.python.org
Tue Nov 23 10:52:58 EST 2021
New submission from Xinhang Xu <xuxinhang4567 at 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 <report at bugs.python.org>
<https://bugs.python.org/issue45880>
_______________________________________
More information about the New-bugs-announce
mailing list