adding a benching script to compare sort algorithms

This commit is contained in:
Dan Buch 2011-08-15 23:04:56 -04:00
parent a7f7b48a77
commit c8d657d3c1

9
bench Executable file
View File

@ -0,0 +1,9 @@
#!/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)'