MCPcopy Index your code
hub / github.com/python/cpython / benchmark_wo_bytecode

Function benchmark_wo_bytecode

Tools/importbench/importbench.py:82–92  ·  view source on GitHub ↗

Source w/o bytecode: {}

(seconds, repeat)

Source from the content-addressed store, hash-verified

80def _wo_bytecode(module):
81 name = module.__name__
82 def benchmark_wo_bytecode(seconds, repeat):
83 """Source w/o bytecode: {}"""
84 bytecode_path = cache_from_source(module.__file__)
85 if os.path.exists(bytecode_path):
86 os.unlink(bytecode_path)
87 sys.dont_write_bytecode = True
88 try:
89 yield from bench(name, lambda: sys.modules.pop(name),
90 repeat=repeat, seconds=seconds)
91 finally:
92 sys.dont_write_bytecode = False
93
94 benchmark_wo_bytecode.__doc__ = benchmark_wo_bytecode.__doc__.format(name)
95 return benchmark_wo_bytecode

Callers

nothing calls this directly

Calls 5

cache_from_sourceFunction · 0.85
benchFunction · 0.85
existsMethod · 0.45
unlinkMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…