mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
Re-order importlib benchmarks to be consistent. Also print out what implementation of __import__ is used.
This commit is contained in:
parent
3fd6e2b910
commit
cae1068e82
1 changed files with 8 additions and 6 deletions
|
|
@ -165,12 +165,13 @@ def main(import_, filename=None, benchmark=None):
|
||||||
prev_results = {}
|
prev_results = {}
|
||||||
__builtins__.__import__ = import_
|
__builtins__.__import__ = import_
|
||||||
benchmarks = (from_cache, builtin_mod,
|
benchmarks = (from_cache, builtin_mod,
|
||||||
source_using_bytecode, source_wo_bytecode,
|
|
||||||
source_writing_bytecode,
|
source_writing_bytecode,
|
||||||
tabnanny_using_bytecode, tabnanny_wo_bytecode,
|
source_wo_bytecode, source_using_bytecode,
|
||||||
tabnanny_writing_bytecode,
|
tabnanny_writing_bytecode,
|
||||||
decimal_using_bytecode, decimal_writing_bytecode,
|
tabnanny_wo_bytecode, tabnanny_using_bytecode,
|
||||||
decimal_wo_bytecode,)
|
decimal_writing_bytecode,
|
||||||
|
decimal_wo_bytecode, decimal_using_bytecode,
|
||||||
|
)
|
||||||
if benchmark:
|
if benchmark:
|
||||||
for b in benchmarks:
|
for b in benchmarks:
|
||||||
if b.__doc__ == benchmark:
|
if b.__doc__ == benchmark:
|
||||||
|
|
@ -183,9 +184,10 @@ def main(import_, filename=None, benchmark=None):
|
||||||
seconds_plural = 's' if seconds > 1 else ''
|
seconds_plural = 's' if seconds > 1 else ''
|
||||||
repeat = 3
|
repeat = 3
|
||||||
header = ('Measuring imports/second over {} second{}, best out of {}\n'
|
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,
|
print(header.format(seconds, seconds_plural, repeat,
|
||||||
len(benchmarks) * seconds * repeat))
|
len(benchmarks) * seconds * repeat, __import__))
|
||||||
new_results = {}
|
new_results = {}
|
||||||
for benchmark in benchmarks:
|
for benchmark in benchmarks:
|
||||||
print(benchmark.__doc__, "[", end=' ')
|
print(benchmark.__doc__, "[", end=' ')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue