A Benchmark for Phobos Sort Algorithm

Craig Black craigblack2 at cox.net
Thu Dec 16 10:02:36 PST 2010


> And here is why. Quicksort is quite famous for being O(n^2) worst case 
> (for sorted data). Your straightforward, simple  (and less generic, I must 
> say) implementation shines for random data, but performs terribly for 
> ordered data. Phobos' sort isn't really plain quicksort so it is slower 
> for random data (yet still of the same complexity as your code best case), 
> but it is pretty fast for ordered data.

Quite right!  Phobos sort does a really good job with ordered data.  The 
simple algorithm doesn't...

-Craig 



More information about the Digitalmars-d mailing list