[PATCH 0 of 3] Fast implemenation of parseindex in C
Martin Geisler
mg at daimi.au.dk
Mon Oct 13 17:39:43 CDT 2008
"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:
http://docs.python.org/library/timeit.html
You can even use it directly from the command line:
python -m timeit 'functions_that_returns_a_lot_of_data()'
It takes care of disabling GC while testing, so it might help you.
--
Martin Geisler
VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial-devel/attachments/20081014/5d2f3571/attachment.pgp
More information about the Mercurial-devel
mailing list