[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) Issue #21634: Fix pystone micro-benchmark: use floor division
victor.stinner
python-checkins at python.org
Mon Jun 2 14:18:28 CEST 2014
http://hg.python.org/cpython/rev/95b7acdc0f24
changeset: 90965:95b7acdc0f24
parent: 90963:e4255fa0fdac
parent: 90964:1318324aa93a
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Jun 02 14:18:15 2014 +0200
summary:
(Merge 3.4) 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.
files:
Lib/test/pystone.py | 13 ++++++++++---
Misc/NEWS | 4 ++++
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/Lib/test/pystone.py b/Lib/test/pystone.py
--- a/Lib/test/pystone.py
+++ b/Lib/test/pystone.py
@@ -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 @@
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 @@
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)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -532,6 +532,10 @@
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
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list