News for hackers. Stuff that matters.
Re:The Art of Command Line by binarycrusader on Monday June 15, 2015 @06:41PM (#9722608)
I have to reiterate this; don't do it -- sort order changes and you'll run into other mysterious issues.

It's not worth the "performance improvement".

Re:The Art of Command Line by unhammer on Tuesday June 16, 2015 @05:39AM (#9724683)
There are good reasons to use LC_ALL=C for certain commands, especially if you want sorting that's stable across different systems. Sometimes you want "aa" to be before "b" even though the Norwegian UTF-8 locale puts it after "å" (which comes after "…zæø"):

    $ echo $'a\naa\nb\nå'| LC_ALL=C sort 
    a
    aa
    b
    å
    $ echo $'a\naa\nb\nå'| LC_ALL=nn_NO.UTF-8 sort 
    a
    b
    å
    aa
Even worse, some characters that are byte-different collate the same:

    $ echo  $'∨\n∧'|LC_ALL=C sort -u
    ∧
    ∨
    $ echo  $'∨\n∧'|sort -u
    ∨
Handling Unicode sanely requires understanding some Unicode.
Re:The Art of Command Line by binarycrusader on Tuesday June 16, 2015 @01:51PM (#9727536)
I'm well aware of that, but in general, don't do it still applies :-)

In general, I'd never do it for performance only, it would have to involve one of the issues you've pointed out (there are some components I build that require it, erroneously IMO).

Re:The Art of Command Line by cle on Monday June 15, 2015 @07:55PM (#9722980)
In some cases, it certainly is worth the improvement. Performance improvements translate into $$$.

Knowing that "LC_ALL=C can improve performance but cause UTF problems" is awesome information to base a design on. A blanket statement like "never use LC_ALL=C" is not.

Re:The Art of Command Line by binarycrusader on Tuesday June 16, 2015 @02:05PM (#9727648)
Short of a bug or other pathological issue, if you resort to messing with locale just to avoid a performance problem, you're likely to hide other issues that will cause problems whenever another user attempts to do the same thing and it breaks.

Again, not worth it -- if only for performance sake, generally speaking.