INNER CODE UNIT · Python
timeit
shenwei356/rush · benchmark.py:8
def timeit(cmd):
t = time.time()
os.system(cmd)
return time.time() - t
# test name, input command, test command
tests = [
['a few stdout', 'seq 1 10', 'echo job:{}; seq 1 10'],
['lots of stdout', 'seq 1 10', 'echo job:{}; seq 1 1000000'],
['a few stdout & run long', 'seq 1 10', 'echo job:{}; sleep 2; seq 1 10'],
['lots of stdout & run long', 'seq 1 10', 'echo job:{}; sleep 2; seq 1 1000000'],
]
apps = {'parallel': {'jobs': '-j', 'keep-order': '-k'}, # parallel: GNU parallel (Perl)
# parallel: https://github.com/mmstick/parallel (Rust)
'rust-parallel': {'jobs': '-j', 'keep-order': ''},
'gargs': {'jobs': '-p', 'keep-order': '-o'}, # gargs: https://github.com/brentp/gargs (Go)
'rush': {'jobs': '-j', 'keep-order': '-k'}} # rush: https://github.com/shenwei356/rush (Go)