A new sort utility

Tim Robbins tjr at FreeBSD.ORG
Mon Sep 15 16:34:22 PDT 2003


On Mon, Sep 15, 2003 at 11:43:07AM -0700, Kris Kennaway wrote:

> On Mon, Sep 15, 2003 at 08:53:56PM +1000, Tim Robbins wrote:
> 
> > It's not quite as fast as the GNU or 4.4BSD sort implementations
> 
> Why is this?

Because it spends too much time comparing lines. In particular, it seems to be
spending a lot of time extracting the specified fields from lines, even when
no -k options are specified.

It's also more general than the 4.4BSD implementation, which can't sort
according to the locale's LC_COLLATE settings, and has a lot of difficulty
sorting numbers (with the -n option) properly. If speed was everything, we'd
already be using that one -- it's significantly faster than GNU.

> I often need to sort huge files, so I'd be reluctant to use an
> implementation with a significant performance penalty.

It would be great if you could compare my sort against GNU on some real world
data and let me know how it goes.


Tim


More information about the freebsd-hackers mailing list