""" Micro-benchmark for function call. Run it with: ./python.orig benchmark.py script bench.py --file=orig ./python.patched benchmark.py script bench.py --file=patch ./python.patched benchmark.py compare_to orig patch Download benchmark.py from: https://bitbucket.org/haypo/misc/raw/tip/python/benchmark.py """ def run_benchmark(bench): bench.timeit(setup='def func(a, b, c): pass\nargs=(1, 2, 3)', stmt='func(*args)') bench.timeit(setup='def func(*args): pass\nargs=(1, 2, 3)', stmt='func(*args)') # not optimized bench.timeit(setup='def func(*args): pass\nargs=(2, 3, 4)', stmt='func(1, *args)')