Re: Profiling, recursive func slower than imperative, normal?

2008-04-17 Thread Terry Reedy
|In that case, I'm not sure you get any performance gain since the queue |has basically the same role as the stack in the recursive version. A |definitive answer calls for an actual test, though. The potential gain comes from not incurring function call overhead and only queueing or stacking the

Re: Profiling, recursive func slower than imperative, normal?

2008-04-17 Thread MRAB
On Apr 17, 9:39 am, Robert Bossy <[EMAIL PROTECTED]> wrote: > Gabriel Genellina wrote: > > En Wed, 16 Apr 2008 17:53:16 -0300, <[EMAIL PROTECTED]> escribió: > > >> On Apr 16, 3:27 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > > >>> Any function can be implemented without recursion, although

Re: Profiling, recursive func slower than imperative, normal?

2008-04-17 Thread Robert Bossy
Gabriel Genellina wrote: > En Wed, 16 Apr 2008 17:53:16 -0300, <[EMAIL PROTECTED]> escribió: > > >> On Apr 16, 3:27 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> >> >>> Any function can be implemented without recursion, although it isn't >>> always easy or fun. >>> >>> >> Rea

Re: Profiling, recursive func slower than imperative, normal?

2008-04-16 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | 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 co

Re: Profiling, recursive func slower than imperative, normal?

2008-04-16 Thread Gabriel Genellina
En Wed, 16 Apr 2008 17:53:16 -0300, <[EMAIL PROTECTED]> escribió: > On Apr 16, 3:27 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > >> Any function can be implemented without recursion, although it isn't >> always easy or fun. >> > Really? I'm curious about that, I can't figure out how that w

Re: Profiling, recursive func slower than imperative, normal?

2008-04-16 Thread s0suk3
On Apr 16, 3:27 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > Any function can be implemented without recursion, although it isn't > always easy or fun. > > Jean-Paul Really? I'm curious about that, I can't figure out how that would work. Could give an example? Say, for example, the typica

Re: Profiling, recursive func slower than imperative, normal?

2008-04-16 Thread Jean-Paul Calderone
On Wed, 16 Apr 2008 13:18:22 -0700 (PDT), [EMAIL PROTECTED] wrote: >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 co

Profiling, recursive func slower than imperative, normal?

2008-04-16 Thread skanemupp
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? def power(nbr,