]> granicus.if.org Git - python/commitdiff
Issue #4704: remove use of cmp() in pybench, bump its version number to 2.1,
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 7 Feb 2009 17:13:31 +0000 (17:13 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 7 Feb 2009 17:13:31 +0000 (17:13 +0000)
and make it 2.6-compatible.

Misc/NEWS
Tools/pybench/Calls.py
Tools/pybench/CommandLine.py
Tools/pybench/README
Tools/pybench/Strings.py
Tools/pybench/pybench.py
Tools/pybench/systimes.py

index d328c61c2b59705a058489eee5999118d4a80cda..16abb93b8e0e683df6d1a794a0c9edf6f8924f02 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -394,6 +394,9 @@ Library
 Tools/Demos
 -----------
 
+- Issue #4704: remove use of cmp() in pybench, bump its version number to 2.1,
+  and make it 2.6-compatible.
+
 - Ttk demos added in Demo/tkinter/ttk/
 
 - Issue #4677: add two list comprehension tests to pybench.
index 7c11867eae399127612e650800b323aaec72d1be..2e6da1840ffb6a92687701a113bc6f8838f97b8e 100644 (file)
@@ -2,7 +2,7 @@ from pybench import Test
 
 class PythonFunctionCalls(Test):
 
-    version = 2.0
+    version = 2.1
     operations = 5*(1+4+4+2)
     rounds = 60000
 
@@ -178,8 +178,8 @@ class BuiltinFunctionCalls(Test):
         # localize functions
         f0 = globals
         f1 = hash
-        f2 = cmp
-        f3 = range
+        f2 = divmod
+        f3 = max
 
         # do calls
         for i in range(self.rounds):
@@ -279,8 +279,8 @@ class BuiltinFunctionCalls(Test):
         # localize functions
         f0 = dir
         f1 = hash
-        f2 = range
-        f3 = range
+        f2 = divmod
+        f3 = max
 
         # do calls
         for i in range(self.rounds):
index d6ef0befacb5967df73de628e72b53b66d432e0f..715bc49b58d1c23a20a02604ae188cdbbf631f0a 100644 (file)
@@ -11,6 +11,8 @@
 
 """
 
+from __future__ import print_function
+
 __copyright__ = """\
 Copyright (c), 1997-2006, Marc-Andre Lemburg (mal@lemburg.com)
 Copyright (c), 2000-2006, eGenix.com Software GmbH (info@egenix.com)
index 022c8dea9caf0fde65a890afc7b7b48ed439c492..b015124719195e0f8e4a5fb49456fc0cfc65b46e 100644 (file)
@@ -82,7 +82,7 @@ Options and default settings:
   --examples       show examples of usage
 
 Version:
- 2.0
+ 2.1
 
 The normal operation is to run the suite and display the
 results. Use -f to save them for later reuse or comparisons.
@@ -95,9 +95,9 @@ Available timers:
 
 Examples:
 
-python2.1 pybench.py -f p21.pybench
-python2.5 pybench.py -f p25.pybench
-python pybench.py -s p25.pybench -c p21.pybench
+python3.0 pybench.py -f p30.pybench
+python3.1 pybench.py -f p31.pybench
+python pybench.py -s p31.pybench -c p30.pybench
 """
 
 License
@@ -111,9 +111,9 @@ Sample output
 
 """
 -------------------------------------------------------------------------------
-PYBENCH 2.0
+PYBENCH 2.1
 -------------------------------------------------------------------------------
-* using Python 2.4.2
+* using CPython 3.0
 * disabled garbage collection
 * system check interval set to maximum: 2147483647
 * using timer: time.time
@@ -141,8 +141,9 @@ Benchmark: 2006-06-12 12:09:25
        Processor:    x86_64
 
     Python:
+       Implementation: CPython
        Executable:   /usr/local/bin/python
-       Version:      2.4.2
+       Version:      3.0
        Compiler:     GCC 3.3.4 (pre 3.3.5 20040809)
        Bits:         64bit
        Build:        Oct  1 2005 15:24:35 (#1)
@@ -331,6 +332,11 @@ versions of the test will list as "n/a" to reflect the change.
 Version History
 ---------------
 
+  2.1: made some minor changes for compatibility with Python 3.0:
+        - replaced cmp with divmod and range with max in Calls.py
+          (cmp no longer exists in 3.0, and range is a list in
+          Python 2.x and an iterator in Python 3.x)
+
   2.0: rewrote parts of pybench which resulted in more repeatable
        timings:
         - made timer a parameter
index 25e2ad5b4655cd1ab4acf206823dacce426536c7..8e3d702a917935b88be067b2995378fe2305b95e 100644 (file)
@@ -1,6 +1,12 @@
 from pybench import Test
 import sys
 
+try:
+    intern
+except NameError:
+    intern = sys.intern
+
+
 class ConcatStrings(Test):
 
     version = 2.0
@@ -174,7 +180,7 @@ class CompareInternedStrings(Test):
     def test(self):
 
         # Make sure the strings *are* interned
-        s = sys.intern(''.join(map(str,range(10))))
+        s = intern(''.join(map(str,range(10))))
         t = s
 
         for i in range(self.rounds):
@@ -240,7 +246,7 @@ class CompareInternedStrings(Test):
 
     def calibrate(self):
 
-        s = sys.intern(''.join(map(str,range(10))))
+        s = intern(''.join(map(str,range(10))))
         t = s
 
         for i in range(self.rounds):
index 4c5ea26a95f7e7066ddae55b1013b24c5a088f61..ea701363c949da9b17f66a38d1fc1021ad03fece 100755 (executable)
@@ -3,14 +3,15 @@
 """ A Python Benchmark Suite
 
 """
-#
-# Note: Please keep this module compatible to Python 1.5.2.
+# Note: Please keep this module compatible to Python 2.6.
 #
 # Tests may include features in later Python versions, but these
 # should then be embedded in try-except clauses in the configuration
 # module Setup.py.
 #
 
+from __future__ import print_function
+
 # pybench Copyright
 __copyright__ = """\
 Copyright (c), 1997-2006, Marc-Andre Lemburg (mal@lemburg.com)
@@ -44,7 +45,7 @@ except ImportError:
     import pickle
 
 # Version number; version history: see README file !
-__version__ = '2.0'
+__version__ = '2.1'
 
 ### Constants
 
@@ -174,7 +175,7 @@ class Test:
     # Version number of the test as float (x.yy); this is important
     # for comparisons of benchmark runs - tests with unequal version
     # number will not get compared.
-    version = 2.0
+    version = 2.1
 
     # The number of abstract operations done in each round of the
     # test. An operation is the basic unit of what you want to
@@ -403,7 +404,7 @@ class Benchmark:
     roundtime = 0
 
     # Benchmark version number as float x.yy
-    version = 2.0
+    version = 2.1
 
     # Produce verbose output ?
     verbose = 0
index a0f30668571cdab0d3ea1812f2e673bc73882642..6bc7e80ef46b4ef39f3dd691d64d96ed7bb635db 100644 (file)
@@ -31,6 +31,9 @@
     the author. All Rights Reserved.
 
 """
+
+from __future__ import print_function
+
 import time, sys
 
 #