4 ms·
faster too $ time sort < t > t-sh real 0m0.016s user 0m0.008s sys 0m0.008s $ time py -c "import sys; open(sys.argv[1],'w').writelines(sort
by 6ren 13y ago
faster too
$ time sort < t > t-sh
real 0m0.016s
user 0m0.008s
sys 0m0.008s
$ time py -c "import sys; open(sys.argv[1],'w').writelines(sorted(open(sys.argv[2]).readlines()))" t-py t
real 0m0.088s
user 0m0.056s
sys 0m0.012s
BTW also a different result (I curled this page for the data).
- tyrion 13y agoIt is faster mainly because of the startup time of the python interpreter. You can improve performances using the "-S" on the python interpreter. I get inconsistent results with time, I think maybe because of context switching as stated here [1]. See my results here: http://pastebin.com/HMUErzee http://pastebin.com/HMUErzee 1: http://stackoverflow.com/questions/9006596/is-the-unix-time-command-accurate-enough-for-benchmarks http://stackoverflow.com/questions/9006596/is-the-unix-time-...
- rofrol 13y agoMy results http://pastebin.com/C1crTA1S http://pastebin.com/C1crTA1S Code from https://github.com/rofrol/go-examples https://github.com/rofrol/go-examples