Method much slower than function?
grante at visi.com
Thu Jun 14 19:08:48 CEST 2007
On 2007-06-14, Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> wrote:
> However, having said that, the speed difference does seem to be real: even
> when I correct the above issue, I get a large time difference using
> either cProfile.run() or profile.run(), and timeit agrees:
>>>> f = bar().readgenome
>>>> timeit.Timer("f(open('cb_foo'))", "from __main__ import f").timeit(5)
>>>> timeit.Timer("readgenome(open('cb_foo'))", "from __main__ import readgenome").timeit(5)
> That's a difference of two orders of magnitude, and I can't see why.
Is it independent of the test order?
What happens when you reverse the order?
What happens if you run the same test twice in a row?
Grant Edwards grante Yow! Thank god!! ... It's
at HENNY YOUNGMAN!!
More information about the Python-list