Stefaan Himpe wrote in news:[EMAIL PROTECTED] in comp.lang.python:
> Nothing weird about this ... > The difference will become larger as your input value becomes larger. > > You can easily understand why if you try to calculate fib(10) by hand, > i.e. work through the algorithm with pencil and paper, > then compare the work you have to do to the memoized version which just > takes fib(9) and fib(8) from memory and adds them together. > I think you missed the point. The problem is that the un-decorated, loop only version takes 35 seconds when called by timeit.Timer. However if you apply the decorator it takes less that a second. In *both* cases the function (fib) only gets called once. Note, I timed the call fib(100) with time.clock() and got a value of less than 1 ms, the memozed version takes about 10 times longer. So the question is: whats going on with timeit.Timer ? Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list