[Python-checkins] python/dist/src/Lib timeit.py,1.15,1.16

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Jan 3 22:47:54 EST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv14750

Modified Files:
	timeit.py 
Log Message:
SF patch #868736:  Disable GC for timeit

Make timings more consistent by temporarily disabling GC.



Index: timeit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** timeit.py	20 Oct 2003 23:38:28 -0000	1.15
--- timeit.py	4 Jan 2004 03:47:51 -0000	1.16
***************
*** 52,55 ****
--- 52,56 ----
  """
  
+ import gc
  import sys
  import time
***************
*** 156,160 ****
          else:
              it = [None] * number
!         return self.inner(it, self.timer)
  
      def repeat(self, repeat=default_repeat, number=default_number):
--- 157,166 ----
          else:
              it = [None] * number
!         gcold = gc.isenabled()
!         gc.disable()
!         timing = self.inner(it, self.timer)
!         if gcold:
!             gc.enable()
!         return timing
  
      def repeat(self, repeat=default_repeat, number=default_number):





More information about the Python-checkins mailing list