On the flip side, timeit
runs through the code 1,000,000 times to get a reasonable asymptotic comparison to other code. cProfile
only runs through the code once, and with only 3 decimal places in the results (0.000), it is not enough to get the full picture.
You get unuseful results like this:
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 a.py:27(function)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}