[Python-checkins] python/dist/src/Lib/test test_long.py,1.17,1.18

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年8月12日 19:17:13 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv21177/python/Lib/test
Modified Files:
	test_long.py 
Log Message:
Machines-- and Python --are a lot faster in relevant ways since this
test was written. So boosted the number of "digits" this generates, and
also beefed up the "* / divmod" test to tickle numbers big enough to
trigger the Karatsuba algorithm. It takes about 2 seconds now on my box.
Index: test_long.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** test_long.py	23 Jul 2002 19:03:56 -0000	1.17
--- test_long.py	13 Aug 2002 02:17:11 -0000	1.18
***************
*** 7,14 ****
 BASE = 2 ** SHIFT
 MASK = BASE - 1
 
 # Max number of base BASE digits to use in test cases. Doubling
! # this will at least quadruple the runtime.
! MAXDIGITS = 10
 
 # build some special values
--- 7,15 ----
 BASE = 2 ** SHIFT
 MASK = BASE - 1
+ KARATSUBA_CUTOFF = 35 # from longobject.c
 
 # Max number of base BASE digits to use in test cases. Doubling
! # this will more than double the runtime.
! MAXDIGITS = 15
 
 # build some special values
***************
*** 91,95 ****
 if verbose:
 print "long / * % divmod"
! digits = range(1, maxdigits+1)
 for lenx in digits:
 x = getran(lenx)
--- 92,97 ----
 if verbose:
 print "long / * % divmod"
! digits = range(1, maxdigits+1) + range(KARATSUBA_CUTOFF,
! KARATSUBA_CUTOFF + 15)
 for lenx in digits:
 x = getran(lenx)

AltStyle によって変換されたページ (->オリジナル) /