2 ms·
As a few have posted, this isn't decades of optimised C vs 80 lines of Haskell, this is basic C vs basic Haskell, and C is orders of magnitude faster. The enti
by maccard 7y ago
As a few have posted, this isn't decades of optimised C vs 80 lines of Haskell, this is basic C vs basic Haskell, and C is orders of magnitude faster.
The entire source for wc is here [0], and is 900 lines of very readable C, it does more than count words, includes options, arguments, usage, licenses. WHen I strip everything back, it's only about 300 lines of very readable C.
[0] https://github.com/coreutils/coreutils/blob/master/src/wc.c https://github.com/coreutils/coreutils/blob/master/src/wc.c