in reply to Fast/Efficient Sort for Large Files

Perl 5.8 uses merge sort instead of qsort. If you aren't already running 5.8, try it. You should see an improvement, unless your program is totally I/O bound.
  • Comment on Re: Fast/Efficient Sort for Large Files

Replies are listed 'Best First'.
Re: Re: Fast/Efficient Sort for Large Files
by Fletch (Bishop) on Dec 19, 2002 at 16:34 UTC

    By default 5.8 uses a merge sort, but you can revert to quicksort if that'd work better for your data. See perldoc -f sort and perldoc sort for more explanation.

      I wrote a program in C++ to sort web server cache logs by IP address. I discovered that a quicksort took forever to sort the data by the IP address, but a heapsort routine that I had in a programming manual was more efficient. If possible, see if you can utilize a binsort routine. If I recall my algorithms class correctly, binsort runs in O(n) time.