Message358056
In short, here are different behaviours in increasing steps of values, which are (based on my researching) giving incorrect results in relation to each other.
Given example:
import functools
import cProfile
def decor(func):
@functools.wraps(func)
def wraps(*args, **kwargs):
return func(*args, **kwargs)
return wraps
@decor
def count(g_val):
if g_val < 1:
print("End")
else:
count(g_val - 1)
cProfile.run('count(VALUE)')
Below I wrote results by given values...
1) VALUE = 50
End
106 function calls (6 primitive calls) in 0.000 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
51/1 0.000 0.000 0.000 0.000 main.py:10(count)
51/1 0.000 0.000 0.000 0.000 main.py:5(wraps)
1 0.000 0.000 0.000 0.000 {built-in method exec}
1 0.000 0.000 0.000 0.000 {built-in method print}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
2) VALUE = 45
End
96 function calls (6 primitive calls) in 0.062 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.062 0.062 <string>:1(<module>)
46/1 0.000 0.000 0.061 0.061 main.py:10(count)
46/1 0.000 0.000 0.062 0.062 main.py:5(wraps)
1 0.000 0.000 0.062 0.062 {built-in method exec}
1 0.061 0.061 0.061 0.061 {built-in method print}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
3) VALUE = 26
End
58 function calls (6 primitive calls) in 0.003 seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.002 0.002 <string>:1(<module>)
27/1 0.000 0.000 0.002 0.002 main.py:10(count)
27/1 0.000 0.000 0.002 0.002 main.py:5(wraps)
1 0.000 0.000 0.003 0.003 {built-in method exec}
1 0.002 0.002 0.002 0.002 {built-in method print}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
As you see above samples are giving surprise results.. 50 - gave 0 sec., but how 26 - gave 0.003 sec or 45 - gave 0.062 sec. Instead of these results I expected increased seconds by linearly. |
|
Date |
User |
Action |
Args |
2019-12-09 06:47:28 | AVicennA | set | recipients:
+ AVicennA, mark.dickinson, pablogsal |
2019-12-09 06:47:28 | AVicennA | set | messageid: <1575874048.83.0.944879385564.issue38993@roundup.psfhosted.org> |
2019-12-09 06:47:28 | AVicennA | link | issue38993 messages |
2019-12-09 06:47:28 | AVicennA | create | |
|