Unix sort command takes much longer depending on where it is executed?! (fastest from ProcessBuilder in program run from IDE, slowest from terminal)
I'm going to venture two guesses:
perhaps you are invoking different versions of sort (do a
which sort
and use the full absolute path to recompare?)perhaps you are using more complicated locale settings (leading to more complicated character set handling etc.)? Try
export LANG=C sort -t' ' -k5,5f -k4,4f -k1,1n /input/file -o /output/file
to compare
Have a look at this project: http://code.google.com/p/externalsortinginjava/
Avoid the need of calling external sort entirely.