From c8d657d3c1acb2e046e7bd9e3c49fb1bc6e6112b Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Mon, 15 Aug 2011 23:04:56 -0400 Subject: [PATCH] adding a benching script to compare sort algorithms --- bench | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 bench diff --git a/bench b/bench new file mode 100755 index 0000000..c346b1a --- /dev/null +++ b/bench @@ -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)'