[PATCH 0 of 3] Fast implemenation of parseindex in C
mpm at selenic.com
Mon Oct 13 17:53:33 CDT 2008
On Tue, 2008-10-14 at 00:39 +0200, Martin Geisler wrote:
> "Bernhard Leiner" <mailinglists.bleiner at gmail.com> writes:
> > [*] Just for the record: measuring performance of a function that
> > returns a big data structure like this seems like a bad idea:
> > for x in xrange(100):
> > start = time.time()
> > res = functions_that_returns_a_lot_of_data()
> > stop = time.time()
> > timing_results.append(stop - start)
> > As soon as 'res' is overwritten a _lot_ of objects are freed and the
> > garbage collector kicks in and delays the following time measurement.
> > This is at least my current theory after staring at strange timing
> > results for too long.
> There is a nice module for this kind of timing experiments:
> You can even use it directly from the command line:
> python -m timeit 'functions_that_returns_a_lot_of_data()'
I posted a Mercurial extension that does much the same thing not long
ago (perf.py). I'll probably stick it in contrib/ as I've found it to be
very handy for this sort of tuning.
It's not clear whether disabling GC globally makes sense for performance
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel