Profiling, recursive func slower than imperative, normal?

Terry Reedy tjreedy at udel.edu
Wed Apr 16 22:58:42 EDT 2008


<skanemupp at yahoo.se> wrote in message 
news:fd522cdd-416a-4241-8d50-9133a4f93a25 at k1g2000prb.googlegroups.com...
| the 0.409 vs 0.095 is the total times right?
| so the imperative function is >4 times faster than the recursive.
| or what does tottime stand for?
|
| is this always the case that the recursive function is slower?
| the gain is less code?
|
| are some functions only implementable recursively?

Computers can be viewed as linear iteration machines implementing

while True:
  execute next instruction and set next pointer appropriately

But algorithms most naturally expressed with multiple recursion usually 
look more ungainly when linearized.







More information about the Python-list mailing list