diff options
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/msi/msi.py | 10 | ||||
-rw-r--r-- | Tools/pybench/Arithmetic.py | 1 | ||||
-rw-r--r-- | Tools/pybench/Calls.py | 1 | ||||
-rw-r--r-- | Tools/pybench/CommandLine.py | 32 | ||||
-rw-r--r-- | Tools/pybench/Constructs.py | 1 | ||||
-rw-r--r-- | Tools/pybench/Dict.py | 71 | ||||
-rw-r--r-- | Tools/pybench/Exceptions.py | 4 | ||||
-rw-r--r-- | Tools/pybench/Imports.py | 5 | ||||
-rw-r--r-- | Tools/pybench/Instances.py | 2 | ||||
-rw-r--r-- | Tools/pybench/Lists.py | 31 | ||||
-rw-r--r-- | Tools/pybench/Lookups.py | 1 | ||||
-rwxr-xr-x | Tools/pybench/NewInstances.py | 66 | ||||
-rw-r--r-- | Tools/pybench/Numbers.py | 216 | ||||
-rw-r--r-- | Tools/pybench/README | 11 | ||||
-rw-r--r-- | Tools/pybench/Setup.py | 4 | ||||
-rw-r--r-- | Tools/pybench/Strings.py | 88 | ||||
-rw-r--r-- | Tools/pybench/Tuples.py | 3 | ||||
-rw-r--r-- | Tools/pybench/Unicode.py | 16 | ||||
-rwxr-xr-x | Tools/pybench/pybench.py | 217 | ||||
-rw-r--r-- | Tools/unicode/gencodec.py | 6 |
20 files changed, 454 insertions, 332 deletions
diff --git a/Tools/msi/msi.py b/Tools/msi/msi.py index f7d384a..33d7bfa 100644 --- a/Tools/msi/msi.py +++ b/Tools/msi/msi.py @@ -846,8 +846,6 @@ def add_files(db): default_feature.set_current() if not msilib.Win64: root.add_file("PCBuild/w9xpopen.exe") - root.add_file("PC/py.ico") - root.add_file("PC/pyc.ico") root.add_file("README.txt", src="README") root.add_file("NEWS.txt", src="Misc/NEWS") root.add_file("LICENSE.txt", src="LICENSE") @@ -956,6 +954,8 @@ def add_files(db): # Add DLLs default_feature.set_current() lib = PyDirectory(db, cab, root, srcdir+"/PCBuild", "DLLs", "DLLS|DLLs") + lib.add_file("py.ico", src="../PC/py.ico") + lib.add_file("pyc.ico", src="../PC/pyc.ico") dlls = [] tclfiles = [] for f in extensions: @@ -1124,11 +1124,11 @@ def add_registry(db): ] + tcl_verbs + [ #Icons ("py.icon", -1, pat2 % (testprefix, ""), "", - r'[TARGETDIR]py.ico', "REGISTRY.def"), + r'[DLLs]py.ico', "REGISTRY.def"), ("pyw.icon", -1, pat2 % (testprefix, "NoCon"), "", - r'[TARGETDIR]py.ico', "REGISTRY.def"), + r'[DLLs]py.ico', "REGISTRY.def"), ("pyc.icon", -1, pat2 % (testprefix, "Compiled"), "", - r'[TARGETDIR]pyc.ico', "REGISTRY.def"), + r'[DLLs]pyc.ico', "REGISTRY.def"), # Descriptions ("py.txt", -1, pat3 % (testprefix, ""), "", "Python File", "REGISTRY.def"), diff --git a/Tools/pybench/Arithmetic.py b/Tools/pybench/Arithmetic.py index e95c30a..4ed6219 100644 --- a/Tools/pybench/Arithmetic.py +++ b/Tools/pybench/Arithmetic.py @@ -775,4 +775,3 @@ class SimpleComplexArithmetic(Test): for i in xrange(self.rounds): pass - diff --git a/Tools/pybench/Calls.py b/Tools/pybench/Calls.py index 82e7a91..e295243 100644 --- a/Tools/pybench/Calls.py +++ b/Tools/pybench/Calls.py @@ -407,4 +407,3 @@ class Recursion(Test): for i in xrange(self.rounds): pass - diff --git a/Tools/pybench/CommandLine.py b/Tools/pybench/CommandLine.py index fb7e07b..13e4f9b 100644 --- a/Tools/pybench/CommandLine.py +++ b/Tools/pybench/CommandLine.py @@ -7,7 +7,7 @@ TODO: * Incorporate the changes made by (see Inbox) - * Add number range option using srange() + * Add number range option using srange() """ @@ -194,7 +194,7 @@ class ArgumentOption(Option): """ Option that takes an argument. An optional default argument can be given. - + """ def __init__(self,name,help=None,default=None): @@ -299,7 +299,7 @@ class Application: values = None # Dictionary of passed options (or default values) # indexed by the options name, e.g. '-h' files = None # List of passed filenames - optionlist = None # List of passed options + optionlist = None # List of passed options def __init__(self,argv=None): @@ -318,15 +318,15 @@ class Application: # Init .arguments list self.arguments = argv[1:] - + # Setup Option mapping self.option_map = option_dict(self.options) - + # Append preset options for option in self.preset_options: if not self.option_map.has_key(option.name): self.add_option(option) - + # Init .files list self.files = [] @@ -336,12 +336,12 @@ class Application: rc = self.startup() if rc is not None: raise SystemExit,rc - + # Parse command line rc = self.parse() if rc is not None: raise SystemExit,rc - + # Start application rc = self.main() if rc is None: @@ -375,7 +375,7 @@ class Application: Note that this has to be done *before* .parse() is being executed. - + """ self.options.append(option) self.option_map[option.name] = option @@ -481,10 +481,10 @@ class Application: This may modify filelist in place. A typical application is checking that at least n files are given. - + If this method returns anything other than None, the process is terminated with the return value as exit code. - + """ return None @@ -554,19 +554,19 @@ class Application: """ This may process the files list in place. """ return None - + # Short option handler def handle_h(self,arg): self.help() return 0 - + def handle_v(self, value): """ Turn on verbose output. """ self.verbose = 1 - + # Handlers for long options have two underscores in their name def handle__help(self,arg): @@ -607,7 +607,7 @@ class Application: it is None, 0 is assumed (meaning OK). Unhandled exceptions are reported with exit status code 1 (see __init__ for further details). - + """ return None @@ -620,7 +620,7 @@ def _test(): header = 'Test Application' version = __version__ options = [Option('-v','verbose')] - + def handle_v(self,arg): print 'VERBOSE, Yeah !' diff --git a/Tools/pybench/Constructs.py b/Tools/pybench/Constructs.py index aba888f..00045bd 100644 --- a/Tools/pybench/Constructs.py +++ b/Tools/pybench/Constructs.py @@ -562,4 +562,3 @@ class ForLoops(Test): l1 = range(1000) for i in xrange(self.rounds): pass - diff --git a/Tools/pybench/Dict.py b/Tools/pybench/Dict.py index 207d88f..54aeae7 100644 --- a/Tools/pybench/Dict.py +++ b/Tools/pybench/Dict.py @@ -93,70 +93,70 @@ class DictWithStringKeys(Test): d['jkl'] = 4 d['mno'] = 5 d['pqr'] = 6 - + d['abc'] d['def'] d['ghi'] d['jkl'] d['mno'] d['pqr'] - + d['abc'] = 1 d['def'] = 2 d['ghi'] = 3 d['jkl'] = 4 d['mno'] = 5 d['pqr'] = 6 - + d['abc'] d['def'] d['ghi'] d['jkl'] d['mno'] d['pqr'] - + d['abc'] = 1 d['def'] = 2 d['ghi'] = 3 d['jkl'] = 4 d['mno'] = 5 d['pqr'] = 6 - + d['abc'] d['def'] d['ghi'] d['jkl'] d['mno'] d['pqr'] - + d['abc'] = 1 d['def'] = 2 d['ghi'] = 3 d['jkl'] = 4 d['mno'] = 5 d['pqr'] = 6 - + d['abc'] d['def'] d['ghi'] d['jkl'] d['mno'] d['pqr'] - + d['abc'] = 1 d['def'] = 2 d['ghi'] = 3 d['jkl'] = 4 d['mno'] = 5 d['pqr'] = 6 - + d['abc'] d['def'] d['ghi'] d['jkl'] d['mno'] d['pqr'] - + def calibrate(self): d = {} @@ -182,70 +182,70 @@ class DictWithFloatKeys(Test): d[4.567] = 4 d[5.678] = 5 d[6.789] = 6 - + d[1.234] d[2.345] d[3.456] d[4.567] d[5.678] d[6.789] - + d[1.234] = 1 d[2.345] = 2 d[3.456] = 3 d[4.567] = 4 d[5.678] = 5 d[6.789] = 6 - + d[1.234] d[2.345] d[3.456] d[4.567] d[5.678] d[6.789] - + d[1.234] = 1 d[2.345] = 2 d[3.456] = 3 d[4.567] = 4 d[5.678] = 5 d[6.789] = 6 - + d[1.234] d[2.345] d[3.456] d[4.567] d[5.678] d[6.789] - + d[1.234] = 1 d[2.345] = 2 d[3.456] = 3 d[4.567] = 4 d[5.678] = 5 d[6.789] = 6 - + d[1.234] d[2.345] d[3.456] d[4.567] d[5.678] d[6.789] - + d[1.234] = 1 d[2.345] = 2 d[3.456] = 3 d[4.567] = 4 d[5.678] = 5 d[6.789] = 6 - + d[1.234] d[2.345] d[3.456] d[4.567] d[5.678] d[6.789] - + def calibrate(self): d = {} @@ -271,70 +271,70 @@ class DictWithIntegerKeys(Test): d[4] = 4 d[5] = 5 d[6] = 6 - + d[1] d[2] d[3] d[4] d[5] d[6] - + d[1] = 1 d[2] = 2 d[3] = 3 d[4] = 4 d[5] = 5 d[6] = 6 - + d[1] d[2] d[3] d[4] d[5] d[6] - + d[1] = 1 d[2] = 2 d[3] = 3 d[4] = 4 d[5] = 5 d[6] = 6 - + d[1] d[2] d[3] d[4] d[5] d[6] - + d[1] = 1 d[2] = 2 d[3] = 3 d[4] = 4 d[5] = 5 d[6] = 6 - + d[1] d[2] d[3] d[4] d[5] d[6] - + d[1] = 1 d[2] = 2 d[3] = 3 d[4] = 4 d[5] = 5 d[6] = 6 - + d[1] d[2] d[3] d[4] d[5] d[6] - + def calibrate(self): d = {} @@ -360,7 +360,7 @@ class SimpleDictManipulation(Test): d[3] = 3 d[4] = 4 d[5] = 5 - + x = d[0] x = d[1] x = d[2] @@ -388,7 +388,7 @@ class SimpleDictManipulation(Test): d[3] = 3 d[4] = 4 d[5] = 5 - + x = d[0] x = d[1] x = d[2] @@ -416,7 +416,7 @@ class SimpleDictManipulation(Test): d[3] = 3 d[4] = 4 d[5] = 5 - + x = d[0] x = d[1] x = d[2] @@ -444,7 +444,7 @@ class SimpleDictManipulation(Test): d[3] = 3 d[4] = 4 d[5] = 5 - + x = d[0] x = d[1] x = d[2] @@ -472,7 +472,7 @@ class SimpleDictManipulation(Test): d[3] = 3 d[4] = 4 d[5] = 5 - + x = d[0] x = d[1] x = d[2] @@ -500,4 +500,3 @@ class SimpleDictManipulation(Test): for i in xrange(self.rounds): pass - diff --git a/Tools/pybench/Exceptions.py b/Tools/pybench/Exceptions.py index 295c83a..7e55708 100644 --- a/Tools/pybench/Exceptions.py +++ b/Tools/pybench/Exceptions.py @@ -38,7 +38,7 @@ class TryRaiseExcept(Test): for i in xrange(self.rounds): pass - + class TryExcept(Test): @@ -677,5 +677,3 @@ class TryExcept(Test): for i in xrange(self.rounds): pass - - diff --git a/Tools/pybench/Imports.py b/Tools/pybench/Imports.py index eb458b4..85eb604 100644 --- a/Tools/pybench/Imports.py +++ b/Tools/pybench/Imports.py @@ -47,7 +47,7 @@ class SecondImport(Test): for i in xrange(self.rounds): pass - + class SecondPackageImport(Test): @@ -92,7 +92,7 @@ class SecondPackageImport(Test): for i in xrange(self.rounds): pass - + class SecondSubmoduleImport(Test): version = 0.1 @@ -136,4 +136,3 @@ class SecondSubmoduleImport(Test): for i in xrange(self.rounds): pass - diff --git a/Tools/pybench/Instances.py b/Tools/pybench/Instances.py index 7663e23..9b1929d 100644 --- a/Tools/pybench/Instances.py +++ b/Tools/pybench/Instances.py @@ -64,5 +64,3 @@ class CreateInstances(Test): for i in xrange(self.rounds): pass - - diff --git a/Tools/pybench/Lists.py b/Tools/pybench/Lists.py index a06b44c..4c18e99 100644 --- a/Tools/pybench/Lists.py +++ b/Tools/pybench/Lists.py @@ -25,7 +25,7 @@ class SimpleListManipulation(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + x = l[0] x = l[1] x = l[2] @@ -46,7 +46,7 @@ class SimpleListManipulation(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + x = l[0] x = l[1] x = l[2] @@ -67,7 +67,7 @@ class SimpleListManipulation(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + x = l[0] x = l[1] x = l[2] @@ -88,7 +88,7 @@ class SimpleListManipulation(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + x = l[0] x = l[1] x = l[2] @@ -109,7 +109,7 @@ class SimpleListManipulation(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + x = l[0] x = l[1] x = l[2] @@ -190,11 +190,11 @@ class SmallLists(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + l[:3] = [1,2,3] m = l[:-1] m = l[1:] - + l[-1:] = [4,5,6] l = [] @@ -212,11 +212,11 @@ class SmallLists(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + l[:3] = [1,2,3] m = l[:-1] m = l[1:] - + l[-1:] = [4,5,6] l = [] @@ -234,11 +234,11 @@ class SmallLists(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + l[:3] = [1,2,3] m = l[:-1] m = l[1:] - + l[-1:] = [4,5,6] l = [] @@ -256,11 +256,11 @@ class SmallLists(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + l[:3] = [1,2,3] m = l[:-1] m = l[1:] - + l[-1:] = [4,5,6] l = [] @@ -278,15 +278,14 @@ class SmallLists(Test): l[3] = 3 l[4] = 4 l[5] = 5 - + l[:3] = [1,2,3] m = l[:-1] m = l[1:] - + l[-1:] = [4,5,6] def calibrate(self): for i in xrange(self.rounds): l = [] - diff --git a/Tools/pybench/Lookups.py b/Tools/pybench/Lookups.py index fbbc0ed..e5529cd 100644 --- a/Tools/pybench/Lookups.py +++ b/Tools/pybench/Lookups.py @@ -943,4 +943,3 @@ class BuiltinMethodLookup(Test): for i in xrange(self.rounds): pass - diff --git a/Tools/pybench/NewInstances.py b/Tools/pybench/NewInstances.py new file mode 100755 index 0000000..a352638 --- /dev/null +++ b/Tools/pybench/NewInstances.py @@ -0,0 +1,66 @@ +from pybench import Test + +class CreateNewInstances(Test): + + version = 0.1 + operations = 3 + 7 + 4 + rounds = 60000 + + def test(self): + + class c(object): + pass + + class d(object): + def __init__(self,a,b,c): + self.a = a + self.b = b + self.c = c + + class e(object): + def __init__(self,a,b,c=4): + self.a = a + self.b = b + self.c = c + self.d = a + self.e = b + self.f = c + + for i in xrange(self.rounds): + o = c() + o1 = c() + o2 = c() + p = d(i,i,3) + p1 = d(i,i,3) + p2 = d(i,3,3) + p3 = d(3,i,3) + p4 = d(i,i,i) + p5 = d(3,i,3) + p6 = d(i,i,i) + q = e(i,i,3) + q1 = e(i,i,3) + q2 = e(i,i,3) + q3 = e(i,i) + + def calibrate(self): + + class c(object): + pass + + class d(object): + def __init__(self,a,b,c): + self.a = a + self.b = b + self.c = c + + class e(object): + def __init__(self,a,b,c=4): + self.a = a + self.b = b + self.c = c + self.d = a + self.e = b + self.f = c + + for i in xrange(self.rounds): + pass diff --git a/Tools/pybench/Numbers.py b/Tools/pybench/Numbers.py index 75cf2ed..a6aea33 100644 --- a/Tools/pybench/Numbers.py +++ b/Tools/pybench/Numbers.py @@ -15,55 +15,55 @@ class CompareIntegers(Test): 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 @@ -75,55 +75,55 @@ class CompareIntegers(Test): 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 @@ -135,55 +135,55 @@ class CompareIntegers(Test): 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 2 > 3 2 < 3 - + 2 < 3 2 > 3 2 == 3 @@ -211,55 +211,55 @@ class CompareFloats(Test): 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 @@ -271,55 +271,55 @@ class CompareFloats(Test): 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 @@ -331,55 +331,55 @@ class CompareFloats(Test): 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 2.1 > 3.31 2.1 < 3.31 - + 2.1 < 3.31 2.1 > 3.31 2.1 == 3.31 @@ -407,55 +407,55 @@ class CompareFloatsIntegers(Test): 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 @@ -467,55 +467,55 @@ class CompareFloatsIntegers(Test): 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 @@ -527,55 +527,55 @@ class CompareFloatsIntegers(Test): 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 2.1 > 4 2.1 < 4 - + 2.1 < 4 2.1 > 4 2.1 == 4 @@ -603,55 +603,55 @@ class CompareLongs(Test): 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L @@ -663,55 +663,55 @@ class CompareLongs(Test): 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L @@ -723,55 +723,55 @@ class CompareLongs(Test): 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L 1234567890L > 3456789012345L 1234567890L < 3456789012345L - + 1234567890L < 3456789012345L 1234567890L > 3456789012345L 1234567890L == 3456789012345L diff --git a/Tools/pybench/README b/Tools/pybench/README index 634e41b..95ae392 100644 --- a/Tools/pybench/README +++ b/Tools/pybench/README @@ -46,6 +46,9 @@ Options and default settings: -w arg set warp factor to arg (20) -d hide noise in compares (0) --no-gc disable garbage collection (0) + --no-syscheck "disable" sys check interval (set to sys.maxint) (0) + -t arg tests containing substring () + -C arg number of calibration runs (20) -v generate verbose output -h show this help text --help show this help text @@ -366,6 +369,14 @@ symbols defined in that module for subclasses of pybench.Test and automatically add them to the benchmark suite. +Breaking Comparability +---------------------- + +If a change is made to any individual test that means it is no +longer strictly comparable with previous runs, the '.version' class +variable should be updated. Therefafter, comparisons with previous +versions of the test will list as "n/a" to reflect the change. + Have fun, -- Marc-Andre Lemburg diff --git a/Tools/pybench/Setup.py b/Tools/pybench/Setup.py index 906a2a9..f5c5190 100644 --- a/Tools/pybench/Setup.py +++ b/Tools/pybench/Setup.py @@ -22,6 +22,10 @@ from Calls import * from Constructs import * from Lookups import * from Instances import * +try: + from NewInstances import * +except: + print "Cannot test new-style objects" from Lists import * from Tuples import * from Dict import * diff --git a/Tools/pybench/Strings.py b/Tools/pybench/Strings.py index 5ab458e..b01843a 100644 --- a/Tools/pybench/Strings.py +++ b/Tools/pybench/Strings.py @@ -81,7 +81,7 @@ class ConcatStrings(Test): for i in xrange(self.rounds): pass - + class CompareStrings(Test): @@ -163,7 +163,7 @@ class CompareStrings(Test): for i in xrange(self.rounds): pass - + class CompareInternedStrings(Test): @@ -245,7 +245,7 @@ class CompareInternedStrings(Test): for i in xrange(self.rounds): pass - + class CreateStringsWithConcat(Test): @@ -320,7 +320,7 @@ class CreateStringsWithConcat(Test): for i in xrange(self.rounds): pass - + class StringSlicing(Test): @@ -334,45 +334,45 @@ class StringSlicing(Test): for i in xrange(self.rounds): - s[50:] - s[:25] - s[50:55] - s[-1:] - s[:1] - s[2:] - s[11:-11] - - s[50:] - s[:25] - s[50:55] - s[-1:] - s[:1] - s[2:] - s[11:-11] - - s[50:] - s[:25] - s[50:55] - s[-1:] - s[:1] - s[2:] - s[11:-11] - - s[50:] - s[:25] - s[50:55] - s[-1:] - s[:1] - s[2:] - s[11:-11] - - s[50:] - s[:25] - s[50:55] - s[-1:] - s[:1] - s[2:] - s[11:-11] + s[50:] + s[:25] + s[50:55] + s[-1:] + s[:1] + s[2:] + s[11:-11] + + s[50:] + s[:25] + s[50:55] + s[-1:] + s[:1] + s[2:] + s[11:-11] + + s[50:] + s[:25] + s[50:55] + s[-1:] + s[:1] + s[2:] + s[11:-11] + + s[50:] + s[:25] + s[50:55] + s[-1:] + s[:1] + s[2:] + s[11:-11] + + s[50:] + s[:25] + s[50:55] + s[-1:] + s[:1] + s[2:] + s[11:-11] def calibrate(self): @@ -560,5 +560,3 @@ if hasattr('', 'lower'): for i in xrange(self.rounds): s = data[i % len_data] - - diff --git a/Tools/pybench/Tuples.py b/Tools/pybench/Tuples.py index 7854def..e84ea53 100644 --- a/Tools/pybench/Tuples.py +++ b/Tools/pybench/Tuples.py @@ -265,7 +265,7 @@ class TupleSlicing(Test): t = tuple(range(100)) for j in r: - + pass class SmallTuples(Test): @@ -362,4 +362,3 @@ class SmallTuples(Test): for i in xrange(self.rounds): pass - diff --git a/Tools/pybench/Unicode.py b/Tools/pybench/Unicode.py index 855fcf2..366f171 100644 --- a/Tools/pybench/Unicode.py +++ b/Tools/pybench/Unicode.py @@ -86,7 +86,7 @@ class ConcatUnicode(Test): for i in xrange(self.rounds): pass - + class CompareUnicode(Test): @@ -168,7 +168,7 @@ class CompareUnicode(Test): for i in xrange(self.rounds): pass - + class CreateUnicodeWithConcat(Test): @@ -243,7 +243,7 @@ class CreateUnicodeWithConcat(Test): for i in xrange(self.rounds): pass - + class UnicodeSlicing(Test): @@ -303,7 +303,7 @@ class UnicodeSlicing(Test): for i in xrange(self.rounds): pass - + ### String methods class UnicodeMappings(Test): @@ -318,7 +318,7 @@ class UnicodeMappings(Test): t = join(map(unichr,range(100)),'') u = join(map(unichr,range(500)),'') v = join(map(unichr,range(1000)),'') - + for i in xrange(self.rounds): s.lower() @@ -375,7 +375,7 @@ class UnicodeMappings(Test): t = join(map(unichr,range(100)),'') u = join(map(unichr,range(500)),'') v = join(map(unichr,range(1000)),'') - + for i in xrange(self.rounds): pass @@ -389,7 +389,7 @@ class UnicodePredicates(Test): data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10) len_data = len(data) - + for i in xrange(self.rounds): s = data[i % len_data] @@ -447,7 +447,7 @@ class UnicodePredicates(Test): data = (u'abc', u'123', u' ', u'\u1234\u2345\u3456', u'\uFFFF'*10) len_data = len(data) - + for i in xrange(self.rounds): s = data[i % len_data] diff --git a/Tools/pybench/pybench.py b/Tools/pybench/pybench.py index 6f10bd1..e0110d0 100755 --- a/Tools/pybench/pybench.py +++ b/Tools/pybench/pybench.py @@ -38,7 +38,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! __version__ = '1.3' # -# NOTE: Use xrange for all test loops unless you want to face +# NOTE: Use xrange for all test loops unless you want to face # a 20MB process ! # # All tests should have rounds set to values so that a run() @@ -85,7 +85,7 @@ class Test: # for comparisons of benchmark runs - tests with unequal version # number will not get compared. version = 1.0 - + # The number of abstract operations done in each round of the # test. An operation is the basic unit of what you want to # measure. The benchmark will output the amount of run-time per @@ -98,7 +98,7 @@ class Test: # Number of rounds to execute per test run. This should be # adjusted to a figure that results in a test run-time of between # 20-50 seconds. - rounds = 100000 + rounds = 10000 ### Internal variables @@ -115,6 +115,8 @@ class Test: if warp > 1: self.rounds = self.rounds / warp + if self.rounds == 0: + self.rounds = 1 self.warp = warp self.times = [] self.overhead = [] @@ -124,64 +126,73 @@ class Test: self.operations = self.operations self.rounds = self.rounds - def run(self): + def run(self, cruns): """ Run the test in two phases: first calibrate, then do the actual test. Be careful to keep the calibration timing low w/r to the test timing. - + """ test = self.test calibrate = self.calibrate clock = time.clock - cruns = self.cruns # first calibrate - offset = 0.0 - for i in range(cruns): - t = clock() - calibrate() - t = clock() - t - offset = offset + t - offset = offset / cruns + t = clock() + calibrate() + offset = clock() - t + if cruns: + for i in range(cruns-1): + t = clock() + calibrate() + t = clock() - t + if t < offset: + offset = t # now the real thing - t = clock() + t = clock() test() t = clock() - t + if t < 0.01: + sys.exit("Lower warp required: test times < 10 ms are unreliable") self.last_timing = (t-offset,t,offset) self.times.append(t-offset) def calibrate(self): - """ Calibrate the test. + """ Calibrate the test. - This method should execute everything that is needed to - setup and run the test - except for the actual operations - that you intend to measure. pybench uses this method to - measure the test implementation overhead. + This method should execute everything that is needed to + setup and run the test - except for the actual operations + that you intend to measure. pybench uses this method to + measure the test implementation overhead. """ return def test(self): - """ Run the test. + """ Run the test. - The test needs to run self.rounds executing - self.operations number of operations each. + The test needs to run self.rounds executing + self.operations number of operations each. """ # do some tests return - + def stat(self): - """ Returns two value: average time per run and average per - operation. - + """ Returns four values: + minimum round time + average time per round + average time per operation + average overhead time + + XXX Should this take warp factors into account? """ runs = len(self.times) if runs == 0: return 0,0 + mintime = min(self.times) totaltime = reduce(operator.add,self.times,0.0) avg = totaltime / float(runs) op_avg = totaltime / float(runs * self.rounds * self.operations) @@ -191,7 +202,7 @@ class Test: else: # use self.last_timing - not too accurate ov_avg = self.last_timing[2] - return avg,op_avg,ov_avg + return mintime, avg, op_avg, ov_avg ### Load Setup @@ -210,105 +221,132 @@ class Benchmark: roundtime = 0 # Average round time version = None # Benchmark version number (see __init__) # as float x.yy - starttime = None # Benchmark start time def __init__(self): self.tests = {} self.version = 0.31 - def load_tests(self,setupmod,warp=1): + def load_tests(self, setupmod, warp=1, limitnames="", verbose=0): self.warp = warp + if limitnames: + limitnames = re.compile(limitnames, re.I) + else: + limitnames = None tests = self.tests - print 'Searching for tests...' + if verbose: + print 'Searching for tests ...', setupmod.__dict__.values() for c in setupmod.__dict__.values(): - if hasattr(c,'is_a_test') and c.__name__ != 'Test': - tests[c.__name__] = c(warp) + if not hasattr(c,'is_a_test'): + continue + name = c.__name__ + if name == 'Test': + continue + if limitnames is not None and limitnames.search(name) is None: + continue + tests[name] = c(warp) l = tests.keys() l.sort() - for t in l: - print ' ',t + if verbose: + print + for t in l: + print ' ', t + print len(l), "tests found" print - def run(self): + def run(self, verbose, cruns): tests = self.tests.items() tests.sort() clock = time.clock - print 'Running %i round(s) of the suite: ' % self.rounds + print 'Running %i round(s) of the suite at warp factor %i:' % (self.rounds, self.warp) print - self.starttime = time.time() roundtime = clock() for i in range(self.rounds): - print ' Round %-25i real abs overhead' % (i+1) + roundstarttime = clock() + if verbose: + print ' Round %-25i real abs overhead' % (i+1) for j in range(len(tests)): - name,t = tests[j] - print '%30s:' % name, - t.run() - print ' %.3fr %.3fa %.3fo' % t.last_timing - print ' ----------------------' - print ' Average round time: %.3f seconds' % \ - ((clock() - roundtime)/(i+1)) - print + name, t = tests[j] + if verbose: + print '%30s:' % name, + t.run(cruns) + if verbose: + print ' %.3fr %.3fa %.3fo' % t.last_timing + if verbose: + print ' ----------------------' + print ' Average round time: %.3f seconds' % \ + ((clock() - roundtime)/(i+1)) + print + else: + print '%d done in %.3f seconds' % (i+1, (clock() - roundstarttime)) self.roundtime = (clock() - roundtime) / self.rounds print - + def print_stat(self, compare_to=None, hidenoise=0): if not compare_to: - print '%-30s per run per oper. overhead' % 'Tests:' - print '-'*72 + print '%-30s min run avg run per oprn overhead' % 'Tests:' + print '-'*77 tests = self.tests.items() tests.sort() + totalmintime = 0 for name,t in tests: - avg,op_avg,ov_avg = t.stat() - print '%30s: %10.2f ms %7.2f us %7.2f ms' % \ - (name,avg*1000.0,op_avg*1000000.0,ov_avg*1000.0) - print '-'*72 - print '%30s: %10.2f ms' % \ - ('Average round time',self.roundtime * 1000.0) + mintime,avg,op_avg,ov_avg = t.stat() + totalmintime += mintime + print '%30s: %9.2f ms %9.2f ms %6.2f us %6.2f' % \ + (name,mintime*1000.0,avg*1000.0,op_avg*1000000.0,ov_avg*1000.0) + print '-'*77 + print '%30s: %9.2f ms' % \ + ('Notional minimum round time', totalmintime * 1000.0) else: - print '%-30s per run per oper. diff *)' % \ + print 'Comparing with: %s (rounds=%i, warp=%i)' % \ + (compare_to.name,compare_to.rounds,compare_to.warp) + print '%-30s min run cmp run avg run diff' % \ 'Tests:' - print '-'*72 + print '-'*77 tests = self.tests.items() tests.sort() compatible = 1 - for name,t in tests: - avg,op_avg,ov_avg = t.stat() + totalmintime = other_totalmintime = 0 + for name, t in tests: + mintime, avg, op_avg, ov_avg = t.stat() + totalmintime += mintime try: other = compare_to.tests[name] except KeyError: other = None if other and other.version == t.version and \ other.operations == t.operations: - avg1,op_avg1,ov_avg1 = other.stat() - qop_avg = (op_avg/op_avg1-1.0)*100.0 + mintime1, avg1, op_avg1, ov_avg1 = other.stat() + other_totalmintime += mintime1 + diff = ((mintime*self.warp)/(mintime1*other.warp) - 1.0)*100.0 if hidenoise and abs(qop_avg) < 10: - qop_avg = '' + diff = '' else: - qop_avg = '%+7.2f%%' % qop_avg + diff = '%+7.2f%%' % diff else: - qavg,qop_avg = 'n/a', 'n/a' + qavg, diff = 'n/a', 'n/a' compatible = 0 - print '%30s: %10.2f ms %7.2f us %8s' % \ - (name,avg*1000.0,op_avg*1000000.0,qop_avg) - print '-'*72 + print '%30s: %8.2f ms %8.2f ms %8.2f ms %8s' % \ + (name,mintime*1000.0,mintime1*1000.0 * compare_to.warp/self.warp, avg*1000.0,diff) + print '-'*77 + # + # Summarise test results + # if compatible and compare_to.roundtime > 0 and \ compare_to.version == self.version: - print '%30s: %10.2f ms %+7.2f%%' % \ - ('Average round time',self.roundtime * 1000.0, - ((self.roundtime*self.warp)/ - (compare_to.roundtime*compare_to.warp)-1.0)*100.0) + print '%30s: %8.2f ms %8.2f ms %+7.2f%%' % \ + ('Notional minimum round time', totalmintime * 1000.0, + other_totalmintime * 1000.0 * compare_to.warp/self.warp, + ((totalmintime*self.warp)/ + (other_totalmintime*compare_to.warp)-1.0)*100.0) else: - print '%30s: %10.2f ms n/a' % \ - ('Average round time',self.roundtime * 1000.0) - print - print '*) measured against: %s (rounds=%i, warp=%i)' % \ - (compare_to.name,compare_to.rounds,compare_to.warp) + print '%30s: %9.2f ms n/a' % \ + ('Notional minimum round time', totalmintime * 1000.0) print def print_machine(): @@ -339,7 +377,12 @@ class PyBenchCmdline(Application): SwitchOption('-S','show statistics of benchmarks',0), ArgumentOption('-w','set warp factor to arg',Setup.Warp_factor), SwitchOption('-d','hide noise in compares', 0), + SwitchOption('-v','verbose output (not recommended)', 0), SwitchOption('--no-gc','disable garbage collection', 0), + SwitchOption('--no-syscheck', + '"disable" sys check interval (set to sys.maxint)', 0), + ArgumentOption('-t', 'tests containing substring', ''), + ArgumentOption('-C', 'number of calibration runs', 20) ] about = """\ @@ -380,7 +423,14 @@ python pybench.py -s p15 -c p14 hidenoise = self.values['-d'] warp = self.values['-w'] nogc = self.values['--no-gc'] - + limitnames = self.values['-t'] + verbose = self.verbose + nosyscheck = self.values['--no-syscheck'] + cruns = self.values['-C'] + print "CRUNS:", cruns + + print 'PYBENCH',__version__ + # Switch off GC if nogc: try: @@ -390,8 +440,13 @@ python pybench.py -s p15 -c p14 else: if self.values['--no-gc']: gc.disable() + print 'NO GC' + + # maximise sys check interval + if nosyscheck: + sys.setcheckinterval(sys.maxint) + print 'CHECKINTERVAL =', sys.maxint - print 'PYBENCH',__version__ print if not compare_to: @@ -407,7 +462,7 @@ python pybench.py -s p15 -c p14 compare_to = bench except IOError: print '* Error opening/reading file',compare_to - compare_to = None + compare_to = None if show_bench: try: @@ -436,9 +491,9 @@ python pybench.py -s p15 -c p14 # Create benchmark object bench = Benchmark() bench.rounds = rounds - bench.load_tests(Setup,warp) + bench.load_tests(Setup, warp, limitnames, verbose) try: - bench.run() + bench.run(verbose, cruns) except KeyboardInterrupt: print print '*** KeyboardInterrupt -- Aborting' diff --git a/Tools/unicode/gencodec.py b/Tools/unicode/gencodec.py index 3cfef20..0aef207 100644 --- a/Tools/unicode/gencodec.py +++ b/Tools/unicode/gencodec.py @@ -318,15 +318,15 @@ class StreamReader(Codec,codecs.StreamReader): ### encodings module API def getregentry(): - return codecs.CodecInfo(( - name=%r, + return codecs.CodecInfo( Codec().encode, Codec().decode, + name=%r, streamwriter=StreamWriter, streamreader=StreamReader, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, - )) + ) ''' % encodingname.replace('_', '-')) # Add decoding table or map (with preference to the table) |