adding a benching script to compare sort algorithms
This commit is contained in:
parent
a7f7b48a77
commit
c8d657d3c1
9
bench
Executable file
9
bench
Executable 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)'
|
Loading…
Reference in New Issue
Block a user