Code Generationdefectgood first issuehelp wanted
描述
Cython 0.27.3, Python 3.6.3.
#cython: binding=True, profile=True
cpdef f(x):
if x > 0:
f(x - 1)
>>> cProfile.run("for i in range(5): proftest.f(2)")
23 function calls (8 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>)
20/5 0.000 0.000 0.000 0.000 proftest.pyx:3(f)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
By comparison, with binding=False (the default):
>>> cProfile.run("for i in range(5): proftest.f(2)")
28 function calls (18 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>)
5 0.000 0.000 0.000 0.000 proftest.pyx:3(f (wrapper))
15/5 0.000 0.000 0.000 0.000 proftest.pyx:3(f)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
5 0.000 0.000 0.000 0.000 {built-in method proftest.f}
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}