A slightly significantly worse implementation of GNU wc in go.
All the files mentioned below are present in the tests/
directory
file | size | time to execute | CPU usage | user CPU time | system CPU time |
---|---|---|---|---|---|
bee-movie.txt | 88k | 0.002s | 76% | 0.00s | 0.00s |
test.txt | 336k | 0.003s | 90% | 0.00s | 0.00s |
1mboftxt | 1.0M | 0.005s | 95% | 0.01s | 0.00s |
les-miserables.txt | 3.3M | 0.020s | 97% | 0.02s | 0.00s |
file | size | time to execute | CPU usage | user CPU time | system CPU time |
---|---|---|---|---|---|
bee-movie.txt | 88k | 0.004s | 120% | 0.01s | 0.00s |
test.txt | 336k | 0.009s | 111% | 0.01s | 0.00s |
1mboftxt | 1.0M | 0.015s | 108% | 0.02s | 0.00s |
les-miserables.txt | 3.3M | 0.051s | 99% | 0.04s | 0.01s |
On average , my program is 163 times slower and consumes 26% more CPU to provide performance that is worse than the wc
tool that ships with most GNU/linux.
- identical results when compared with GNU
wc
over the test data. -v
flag to understand what the hell is actually being printed
- cannot read from stdin if no file is passed so
cat somefile.txt | gwc -l
won't work. - messy codebase
- no automated testing
- slower
- rewrite using simpler techniques.
- use charmcli tools and have nice coloured output
- read from stdin if no file is provided