]> granicus.if.org Git - python/commitdiff
Issue #21634: Fix pystone micro-benchmark: use floor division instead of true
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 2 Jun 2014 12:16:44 +0000 (14:16 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 2 Jun 2014 12:16:44 +0000 (14:16 +0200)
division to benchmark integers instead of floating point numbers. Set pystone
version to 1.2. Patch written by Lennart Regebro.

Lib/test/pystone.py
Misc/NEWS

index d7f1ec9b6cc736fe7c51c32580d3e86872d60e81..a41f1e53a569e3388a0a129e4b1e2fa09fbabe3a 100755 (executable)
@@ -3,7 +3,7 @@
 """
 "PYSTONE" Benchmark Program
 
-Version:        Python/1.1 (corresponds to C/1.1 plus 2 Pystone fixes)
+Version:        Python/1.2 (corresponds to C/1.1 plus 3 Pystone fixes)
 
 Author:         Reinhold P. Weicker,  CACM Vol 27, No 10, 10/84 pg. 1013.
 
@@ -30,13 +30,20 @@ Version History:
                 percent faster than version 1.0, so benchmark figures
                 of different versions can't be compared directly.
 
+                Version 1.2 changes the division to floor division.
+
+                Under Python 3 version 1.1 would use the normal division
+                operator, resulting in some of the operations mistakenly
+                yielding floats. Version 1.2 instead uses floor division
+                making the benchmark a integer benchmark again.
+
 """
 
 LOOPS = 50000
 
 from time import clock
 
-__version__ = "1.1"
+__version__ = "1.2"
 
 [Ident1, Ident2, Ident3, Ident4, Ident5] = range(1, 6)
 
@@ -123,7 +130,7 @@ def Proc0(loops=LOOPS):
                 EnumLoc = Proc6(Ident1)
             CharIndex = chr(ord(CharIndex)+1)
         IntLoc3 = IntLoc2 * IntLoc1
-        IntLoc2 = IntLoc3 / IntLoc1
+        IntLoc2 = IntLoc3 // IntLoc1
         IntLoc2 = 7 * (IntLoc3 - IntLoc2) - IntLoc1
         IntLoc1 = Proc2(IntLoc1)
 
index c03534b212227051fd00d3f1d8ccccfb8304cd6a..a8c6b35559f206e1d9f0cb2bb2b1af1738dc01b6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -46,7 +46,7 @@ Library
 - Issue #14710: pkgutil.find_loader() no longer raises an exception when a
   module doesn't exist.
 
-- Issue #21481:  Argparse equality and inequality tests now return 
+- Issue #21481:  Argparse equality and inequality tests now return
   NotImplemented when comparing to an unknown type.
 
 - Issue #8743: Fix interoperability between set objects and the
@@ -66,6 +66,10 @@ Build
 Tests
 -----
 
+- Issue #21634: Fix pystone micro-benchmark: use floor division instead of true
+  division to benchmark integers instead of floating point numbers. Set pystone
+  version to 1.2. Patch written by Lennart Regebro.
+
 - Issue #21605: Added tests for Tkinter images.
 
 - Issue #21493: Added test for ntpath.expanduser().  Original patch by