|
|
|
|
|
by ColinWright
2327 days ago
|
|
So I just wrote the most naive version of wc I could think of in C, matching the capability of this Haskell version, and I smoked the system wc ... my code, unoptimised, was over twice as fast. $ time wc Backups/Tera2/files.txt 1123699 2283439 161361844 Backups/Tera2/files.txt
real 0m2.010s
user 0m1.964s
sys 0m0.020s
$ time naive Backups/Tera2/files.txt L: 1123699
W: 2283439
C: 161361844
real 0m0.864s
user 0m0.835s
sys 0m0.028s
Smoked !!(See my comment elsewhere[0] for a more sensible comment) [0] https://news.ycombinator.com/item?id=22234673 -------- Update: I just compiled with -O3 and got user time of 0.24 secs. This version is 8 times faster than the system wc. |
|
That being said, unlike the OP, I don't think it means anything as wc is likely supporting more features than my program.
https://gist.github.com/felixge/aa70fc97e893a7eb0bd4c801f8f5...