mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Updated to pybench 2.0.
See svn.python.org/external/pybench-2.0 for the original import of that version. Note that platform.py was not copied over from pybench-2.0 since it is already part of Python 2.5.
This commit is contained in:
parent
ef7fe5f228
commit
7d9743dd6a
20 changed files with 1240 additions and 649 deletions
|
@ -2,9 +2,9 @@ from pybench import Test
|
|||
|
||||
class TryRaiseExcept(Test):
|
||||
|
||||
version = 0.1
|
||||
operations = 2 + 3
|
||||
rounds = 60000
|
||||
version = 2.0
|
||||
operations = 2 + 3 + 3
|
||||
rounds = 80000
|
||||
|
||||
def test(self):
|
||||
|
||||
|
@ -31,6 +31,18 @@ class TryRaiseExcept(Test):
|
|||
raise error,"something"
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
raise error("something")
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
raise error("something")
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
raise error("something")
|
||||
except:
|
||||
pass
|
||||
|
||||
def calibrate(self):
|
||||
|
||||
|
@ -42,9 +54,9 @@ class TryRaiseExcept(Test):
|
|||
|
||||
class TryExcept(Test):
|
||||
|
||||
version = 0.1
|
||||
version = 2.0
|
||||
operations = 15 * 10
|
||||
rounds = 200000
|
||||
rounds = 150000
|
||||
|
||||
def test(self):
|
||||
|
||||
|
@ -677,3 +689,11 @@ class TryExcept(Test):
|
|||
|
||||
for i in xrange(self.rounds):
|
||||
pass
|
||||
|
||||
### Test to make Fredrik happy...
|
||||
|
||||
if __name__ == '__main__':
|
||||
import timeit
|
||||
timeit.TestClass = TryRaiseExcept
|
||||
timeit.main(['-s', 'test = TestClass(); test.rounds = 1000',
|
||||
'test.test()'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue