See More

""" Micro-benchmark for the Python operation str.format(). Run it with: ./python.orig benchmark.py script bench_long.py --file=orig ./python.patched benchmark.py script bench_long.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 """ import sys def run_benchmark(bench): bench.timeit('x+y', setup='x=1; y=2', name="1+2") bench.timeit('x+y; ' * 100, setup='x=1; y=2', name='"1+2" ran 100 times')