[Python-checkins] python/dist/src/Doc/lib libtimeit.tex,1.6,1.7

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sun Jan 4 16:19:21 EST 2004


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv21312

Modified Files:
	libtimeit.tex 
Log Message:
Show how to re-enable GC during timings.

Index: libtimeit.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtimeit.tex,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** libtimeit.tex	20 Sep 2003 11:09:28 -0000	1.6
--- libtimeit.tex	4 Jan 2004 21:19:18 -0000	1.7
***************
*** 83,86 ****
--- 83,98 ----
  statement, the setup statement and the timer function to be used are
  passed to the constructor.
+ 
+ \begin{notice}
+ By default, \method{timeit()} temporarily turns off garbage collection
+ during the timing.  The advantage of this approach is that it makes
+ independent timings more comparable.  This disadvantage is that GC
+ may be an important component of the performance of the function being
+ measured.  If so, GC can be re-enabled as the first statement in the
+ \var{setup} string.  For example:
+ \begin{verbatim}
+     timeit.Timer('for i in xrange(10): oct(i)', 'gc.enable()').timeit()
+ \end{verbatim}
+ \end{notice}
  \end{methoddesc}
  





More information about the Python-checkins mailing list