box-o-sand/bench

10 lines
260 B
Plaintext
Raw Normal View History

#!/bin/bash
SETUP="import sorting;import random;l = list(range(0, ${1-5000}));random.shuffle(l)"
echo -n "insertion sort: "
python -m timeit -s "$SETUP" 'sorting.insertion_sort(l)'
echo -n "merge sort: "
python -m timeit -s "$SETUP" 'sorting.merge_sort(l)'