Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8a68122e
Commit
8a68122e
authored
Feb 07, 2009
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #4704: remove use of cmp() in pybench, bump its version number to 2.1,
and make it 2.6-compatible.
parent
7bf8d4ed
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
19 deletions
+40
-19
Misc/NEWS
Misc/NEWS
+3
-0
Tools/pybench/Calls.py
Tools/pybench/Calls.py
+5
-5
Tools/pybench/CommandLine.py
Tools/pybench/CommandLine.py
+2
-0
Tools/pybench/README
Tools/pybench/README
+13
-7
Tools/pybench/Strings.py
Tools/pybench/Strings.py
+8
-2
Tools/pybench/pybench.py
Tools/pybench/pybench.py
+6
-5
Tools/pybench/systimes.py
Tools/pybench/systimes.py
+3
-0
No files found.
Misc/NEWS
View file @
8a68122e
...
@@ -394,6 +394,9 @@ Library
...
@@ -394,6 +394,9 @@ Library
Tools/Demos
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/
- Ttk demos added in Demo/tkinter/ttk/
- Issue #4677: add two list comprehension tests to pybench.
- Issue #4677: add two list comprehension tests to pybench.
...
...
Tools/pybench/Calls.py
View file @
8a68122e
...
@@ -2,7 +2,7 @@ from pybench import Test
...
@@ -2,7 +2,7 @@ from pybench import Test
class
PythonFunctionCalls
(
Test
):
class
PythonFunctionCalls
(
Test
):
version
=
2.
0
version
=
2.
1
operations
=
5
*
(
1
+
4
+
4
+
2
)
operations
=
5
*
(
1
+
4
+
4
+
2
)
rounds
=
60000
rounds
=
60000
...
@@ -178,8 +178,8 @@ class BuiltinFunctionCalls(Test):
...
@@ -178,8 +178,8 @@ class BuiltinFunctionCalls(Test):
# localize functions
# localize functions
f0
=
globals
f0
=
globals
f1
=
hash
f1
=
hash
f2
=
cmp
f2
=
divmod
f3
=
range
f3
=
max
# do calls
# do calls
for
i
in
range
(
self
.
rounds
):
for
i
in
range
(
self
.
rounds
):
...
@@ -279,8 +279,8 @@ class BuiltinFunctionCalls(Test):
...
@@ -279,8 +279,8 @@ class BuiltinFunctionCalls(Test):
# localize functions
# localize functions
f0
=
dir
f0
=
dir
f1
=
hash
f1
=
hash
f2
=
range
f2
=
divmod
f3
=
range
f3
=
max
# do calls
# do calls
for
i
in
range
(
self
.
rounds
):
for
i
in
range
(
self
.
rounds
):
...
...
Tools/pybench/CommandLine.py
View file @
8a68122e
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
"""
"""
from
__future__
import
print_function
__copyright__
=
"""
\
__copyright__
=
"""
\
Copyright (c), 1997-2006, Marc-Andre Lemburg (mal@lemburg.com)
Copyright (c), 1997-2006, Marc-Andre Lemburg (mal@lemburg.com)
Copyright (c), 2000-2006, eGenix.com Software GmbH (info@egenix.com)
Copyright (c), 2000-2006, eGenix.com Software GmbH (info@egenix.com)
...
...
Tools/pybench/README
View file @
8a68122e
...
@@ -82,7 +82,7 @@ Options and default settings:
...
@@ -82,7 +82,7 @@ Options and default settings:
--examples show examples of usage
--examples show examples of usage
Version:
Version:
2.
0
2.
1
The normal operation is to run the suite and display the
The normal operation is to run the suite and display the
results. Use -f to save them for later reuse or comparisons.
results. Use -f to save them for later reuse or comparisons.
...
@@ -95,9 +95,9 @@ Available timers:
...
@@ -95,9 +95,9 @@ Available timers:
Examples:
Examples:
python
2.1 pybench.py -f p21
.pybench
python
3.0 pybench.py -f p30
.pybench
python
2.5 pybench.py -f p25
.pybench
python
3.1 pybench.py -f p31
.pybench
python pybench.py -s p
25.pybench -c p21
.pybench
python pybench.py -s p
31.pybench -c p30
.pybench
"""
"""
License
License
...
@@ -111,9 +111,9 @@ Sample output
...
@@ -111,9 +111,9 @@ Sample output
"""
"""
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
PYBENCH 2.
0
PYBENCH 2.
1
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
* using
Python 2.4.2
* using
CPython 3.0
* disabled garbage collection
* disabled garbage collection
* system check interval set to maximum: 2147483647
* system check interval set to maximum: 2147483647
* using timer: time.time
* using timer: time.time
...
@@ -141,8 +141,9 @@ Benchmark: 2006-06-12 12:09:25
...
@@ -141,8 +141,9 @@ Benchmark: 2006-06-12 12:09:25
Processor: x86_64
Processor: x86_64
Python:
Python:
Implementation: CPython
Executable: /usr/local/bin/python
Executable: /usr/local/bin/python
Version:
2.4.2
Version:
3.0
Compiler: GCC 3.3.4 (pre 3.3.5 20040809)
Compiler: GCC 3.3.4 (pre 3.3.5 20040809)
Bits: 64bit
Bits: 64bit
Build: Oct 1 2005 15:24:35 (#1)
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.
...
@@ -331,6 +332,11 @@ versions of the test will list as "n/a" to reflect the change.
Version History
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
2.0: rewrote parts of pybench which resulted in more repeatable
timings:
timings:
- made timer a parameter
- made timer a parameter
...
...
Tools/pybench/Strings.py
View file @
8a68122e
from
pybench
import
Test
from
pybench
import
Test
import
sys
import
sys
try
:
intern
except
NameError
:
intern
=
sys
.
intern
class
ConcatStrings
(
Test
):
class
ConcatStrings
(
Test
):
version
=
2.0
version
=
2.0
...
@@ -174,7 +180,7 @@ class CompareInternedStrings(Test):
...
@@ -174,7 +180,7 @@ class CompareInternedStrings(Test):
def
test
(
self
):
def
test
(
self
):
# Make sure the strings *are* interned
# Make sure the strings *are* interned
s
=
sys
.
intern
(
''
.
join
(
map
(
str
,
range
(
10
))))
s
=
intern
(
''
.
join
(
map
(
str
,
range
(
10
))))
t
=
s
t
=
s
for
i
in
range
(
self
.
rounds
):
for
i
in
range
(
self
.
rounds
):
...
@@ -240,7 +246,7 @@ class CompareInternedStrings(Test):
...
@@ -240,7 +246,7 @@ class CompareInternedStrings(Test):
def
calibrate
(
self
):
def
calibrate
(
self
):
s
=
sys
.
intern
(
''
.
join
(
map
(
str
,
range
(
10
))))
s
=
intern
(
''
.
join
(
map
(
str
,
range
(
10
))))
t
=
s
t
=
s
for
i
in
range
(
self
.
rounds
):
for
i
in
range
(
self
.
rounds
):
...
...
Tools/pybench/pybench.py
View file @
8a68122e
...
@@ -3,14 +3,15 @@
...
@@ -3,14 +3,15 @@
""" A Python Benchmark Suite
""" A Python Benchmark Suite
"""
"""
#
# Note: Please keep this module compatible to Python 2.6.
# Note: Please keep this module compatible to Python 1.5.2.
#
#
# Tests may include features in later Python versions, but these
# Tests may include features in later Python versions, but these
# should then be embedded in try-except clauses in the configuration
# should then be embedded in try-except clauses in the configuration
# module Setup.py.
# module Setup.py.
#
#
from
__future__
import
print_function
# pybench Copyright
# pybench Copyright
__copyright__
=
"""
\
__copyright__
=
"""
\
Copyright (c), 1997-2006, Marc-Andre Lemburg (mal@lemburg.com)
Copyright (c), 1997-2006, Marc-Andre Lemburg (mal@lemburg.com)
...
@@ -44,7 +45,7 @@ except ImportError:
...
@@ -44,7 +45,7 @@ except ImportError:
import
pickle
import
pickle
# Version number; version history: see README file !
# Version number; version history: see README file !
__version__
=
'2.
0
'
__version__
=
'2.
1
'
### Constants
### Constants
...
@@ -174,7 +175,7 @@ class Test:
...
@@ -174,7 +175,7 @@ class Test:
# Version number of the test as float (x.yy); this is important
# Version number of the test as float (x.yy); this is important
# for comparisons of benchmark runs - tests with unequal version
# for comparisons of benchmark runs - tests with unequal version
# number will not get compared.
# number will not get compared.
version
=
2.
0
version
=
2.
1
# The number of abstract operations done in each round of the
# The number of abstract operations done in each round of the
# test. An operation is the basic unit of what you want to
# test. An operation is the basic unit of what you want to
...
@@ -403,7 +404,7 @@ class Benchmark:
...
@@ -403,7 +404,7 @@ class Benchmark:
roundtime
=
0
roundtime
=
0
# Benchmark version number as float x.yy
# Benchmark version number as float x.yy
version
=
2.
0
version
=
2.
1
# Produce verbose output ?
# Produce verbose output ?
verbose
=
0
verbose
=
0
...
...
Tools/pybench/systimes.py
View file @
8a68122e
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
the author. All Rights Reserved.
the author. All Rights Reserved.
"""
"""
from
__future__
import
print_function
import
time
,
sys
import
time
,
sys
#
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment