Closed as not planned
Description
Bug report
I believe that the cProfiler is less helpful now in python 3.12 when attempting to point a developer to a list comprehension as the bottleneck. With python 3.11, it points out that there is a listcomp
that is responsible for the bulk of the duration. In 3.12, that line is missing.
Python 3.11.4
>>> import cProfile
>>> cProfile.run('[i for i in range(50000) if i % 2 == 0]')
4 function calls in 0.009 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.009 0.009 0.009 0.009 <string>:1(<listcomp>)
1 0.000 0.000 0.009 0.009 <string>:1(<module>)
1 0.000 0.000 0.009 0.009 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
Python 3.12.0b4
>>> cProfile.run('[i for i in range(50000) if i % 2 == 0]')
3 function calls in 0.006 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.006 0.006 0.006 0.006 <string>:1(<module>)
1 0.000 0.000 0.006 0.006 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
Your environment
- CPython versions tested on: 3.12.0b4
- Operating system and architecture: Ubuntu 22.04.2 LTS