In [2]: %prun fib(40) 331160284 function calls (4 primitive calls) in 95.272 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 331160281/1 95.272 0.000 95.272 95.272 fib.py:5(fib) 1 0.000 0.000 95.272 95.272 {built-in method builtins.exec} 1 0.000 0.000 95.272 95.272 :1() 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} In [3]: %prun fib_tail(40) 43 function calls (4 primitive calls) in 0.000 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 40/1 0.000 0.000 0.000 0.000 fib.py:12(fib_tail) 1 0.000 0.000 0.000 0.000 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 :1() 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}