in reply to Re: Efficiently sorting array by non-alpha strings
in thread Efficiently sorting array by non-alpha strings
Thanks for the reply. I've not used the Schwarztian Transform before so tend to shy away from it. However, I read a bit more about it and discovered that it won't work for my actual code which is an array of objects.
Your bucketsort is the elegant solution that I was seeking. Interesting though it's about twice as slow as my ugly version as indicated by this benchmark:
Benchmark: timing 500000 iterations of bucketsort, sort... bucketsort: 2 wallclock secs ( 1.72 usr + 0.00 sys = 1.72 CPU) @ 29 +0697.67/s (n=500000) sort: 0 wallclock secs ( 0.89 usr + 0.00 sys = 0.89 CPU) @ 56 +1797.75/s (n=500000) Rate bucketsort sort bucketsort 290698/s -- -48% sort 561798/s 93% --
Thanks
-Wm
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Efficiently sorting array by non-alpha strings
by Abigail-II (Bishop) on Feb 20, 2004 at 16:31 UTC | |
by borisz (Canon) on Feb 20, 2004 at 16:48 UTC | |
by Abigail-II (Bishop) on Feb 20, 2004 at 17:02 UTC | |
by borisz (Canon) on Feb 20, 2004 at 17:11 UTC | |
by knowmad (Monk) on Feb 20, 2004 at 17:04 UTC | |
by Abigail-II (Bishop) on Feb 20, 2004 at 17:12 UTC |