On Jan 29, 1:48 am, [EMAIL PROTECTED] wrote: > Marc 'BlackJack' Rintsch: > > > Try calling the iterative one twice and measure the time of the second > > call. IIRC psyco needs at least one call to analyze the function, so the > > first call is not speed up. > > That's how Java HotSpot works, but Psyco is very different from > HotSpot, and I think you are wrong. > I don't exactly know the answer to the question of the OP, but I think > the two functions are different: in the second function most time > isn't spent in managing the xrange or in the assign, but in the sum > between long ints, and Psyco can't speed up that operation (you need > gmpy for that, and in certain tricky situations gmpy may even result > slower, maybe when you use small numbers). > > Bye, > bearophile
Thanks, that's probably it I've tested >>> timeit.Timer('c+d', 'from __main__ import c, d').timeit(1000) 6.6209532214145383e-005 >>> timeit.Timer('a+b', 'from __main__ import a, b').timeit(1000) 0.10513989906537802 >>> where c and d are equal to 1, and a, b are very long integers (a=b=fib2(100000)) -- http://mail.python.org/mailman/listinfo/python-list