[Python-checkins] cpython: Re-order importlib benchmarks to be consistent. Also print out what

brett.cannon python-checkins at python.org
Tue Feb 7 15:41:04 CET 2012


http://hg.python.org/cpython/rev/5a13dda023df
changeset:   74818:5a13dda023df
user:        Brett Cannon <brett at python.org>
date:        Tue Feb 07 09:40:33 2012 -0500
summary:
  Re-order importlib benchmarks to be consistent. Also print out what implementation of __import__ is used.

files:
  Lib/importlib/test/benchmark.py |  14 ++++++++------
  1 files changed, 8 insertions(+), 6 deletions(-)


diff --git a/Lib/importlib/test/benchmark.py b/Lib/importlib/test/benchmark.py
--- a/Lib/importlib/test/benchmark.py
+++ b/Lib/importlib/test/benchmark.py
@@ -165,12 +165,13 @@
         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 @@
     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=' ')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list