Profiling results with python2.4 and python2.5
By Maxime Biais, Monday 26 February 2007 at 23:04 :: Python :: #35 :: rss
I was playing with a python function that I wanted to profile. I used python2.5 and python2.4 to run the following code:
from profileit import profileit import operator import time timed = 0 def timemeth(func): def _inner(self, *args, **kw): start = time.time() res = func(self, *args, **kw) global timed timed = time.time() - start return res return _inner @profileit(0) @timemeth def mip0(iterable): reduce(operator.add, iterable, 0) mip0(xrange(100000)) print "timed %.3f seconds" % timed
Outputs with python2.5:
$ python2.5 reducecomp.py|grep seconds
2 function calls in 1.310 CPU seconds
timed 1.310 seconds
Everything seems OK, and now the output with python2.4:
$ python2.4 reducecomp.py|grep seconds
2 function calls in 0.000 CPU seconds
timed 1.336 seconds
0.000 seconds ? that's really fast... Something goes wrong with the profiler ?



Comments
No comment.
Write your comment