]> granicus.if.org Git - python/commitdiff
Re-order importlib benchmarks to be consistent. Also print out what implementation...
authorBrett Cannon <brett@python.org>
Tue, 7 Feb 2012 14:40:33 +0000 (09:40 -0500)
committerBrett Cannon <brett@python.org>
Tue, 7 Feb 2012 14:40:33 +0000 (09:40 -0500)
Lib/importlib/test/benchmark.py

index 025bc56c6e633f0ab22f9bcfc39e0026ea6af98d..ed88f04bded3567fc2feed290fff127ca5225c4c 100644 (file)
@@ -165,12 +165,13 @@ def main(import_, filename=None, benchmark=None):
         prev_results = {}
     __builtins__.__import__ = import_
     benchmarks = (from_cache, builtin_mod,
-                  source_using_bytecode, source_wo_bytecode,
                   source_writing_bytecode,
-                  tabnanny_using_bytecode, tabnanny_wo_bytecode,
+                  source_wo_bytecode, source_using_bytecode,
                   tabnanny_writing_bytecode,
-                  decimal_using_bytecode, decimal_writing_bytecode,
-                  decimal_wo_bytecode,)
+                  tabnanny_wo_bytecode, tabnanny_using_bytecode,
+                  decimal_writing_bytecode,
+                  decimal_wo_bytecode, decimal_using_bytecode,
+                )
     if benchmark:
         for b in benchmarks:
             if b.__doc__ == benchmark:
@@ -183,9 +184,10 @@ def main(import_, filename=None, benchmark=None):
     seconds_plural = 's' if seconds > 1 else ''
     repeat = 3
     header = ('Measuring imports/second over {} second{}, best out of {}\n'
-              'Entire benchmark run should take about {} seconds\n')
+              'Entire benchmark run should take about {} seconds\n'
+              'Using {!r} as __import__\n')
     print(header.format(seconds, seconds_plural, repeat,
-                        len(benchmarks) * seconds * repeat))
+                        len(benchmarks) * seconds * repeat, __import__))
     new_results = {}
     for benchmark in benchmarks:
         print(benchmark.__doc__, "[", end=' ')