On Jun 27, 2007, at 10:27 PM, Carl Lowenstein wrote:


Just for fun, try running each qsort implementation on an array that
is already sorted.  This should bring out the worst-case performance.

So, I did try it out. I haven't had time to test out qsort1 with it, but I expect it is similar to qsort3 which is bad enough (and gives you an idea of just how qsort1 should be performing relative to qsort3 if it really was O(n^2) ):

With 100,000 elements:

real    47m50.657s
user    40m1.524s
sys     0m43.578s

With 10,000 elements:

real    0m11.149s
user    0m9.891s
sys     0m0.162s

With 1,000 elements:

real    0m0.226s
user    0m0.162s
sys     0m0.017s

I didn't have the patience to try it with a million elements. ;-)

--Chris

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to