Skip to content
Prev 10923 / 398502 Next

Benchmarking R, why sort() is so slow?

On Fri, 27 Apr 2001, Philippe Grosjean wrote:

            
Actually, I'm not convinced on the speed issue. Shellsort works very well
for vectors of lengths that R can reasonably handle. Using a million
record dataset in R you really can't get much done in the 20seconds that a
really good sorting routine might save you.

Heapsort might be worth trying -- it has good worst-case behaviour and is
about half as fast as the typical case of quicksort.  Merge sort might
also be nice because it's stable: it leaves ties in the order it found
them, but it needs extra space. Still, I don't think it's a high
optimisation priority.

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._