GNU bug report logs - #7182
sort -R slow

Previous Next

Package: coreutils;

Reported by: Ole Tange <tange <at> gnu.org>

Date: Sat, 9 Oct 2010 13:12:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 7182 <at> debbugs.gnu.org (full text, mbox):

From: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
To: tange <at> gnu.org (Ole Tange)
Cc: 7182 <at> debbugs.gnu.org
Subject: Re: bug#7182: sort -R slow
Date: Sat, 9 Oct 2010 14:21:00 -0500 (GMT+5)
Ole Tange writes:
> 
> I recently needed to randomize some lines. So I tried using 'sort -R'.
> I was astonished how slow that was. So I tested how slow a competing
> strategies are. GNU sort is two magnitudes slower than unsort and more
> than one magnitude slower than perl:

Never heard of "unsort". Why didn't you try shuf(1)?

Also, your perl is not valid:

> 
> $ time perl -e 'print sort { rand() <=> rand() } <>' file
> real    0m6.621s

That comparison function is not consistent (unless very lucky).

> I would expect sort -R to be faster than sort and faster than Perl if
> not as fast as unsort.

How big is your test file? I expect sort(1) to be optimized for big jobs. I
bet it would win the contest if you are shuffling a file that's bigger than
available RAM.





This bug report was last modified 13 years and 350 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.