3 ms·
Author here. Why do you feel it is code golf? My primary focus when writing it was readability - I'm sure I could do it in much less than 70 lines if I had to.
by ajeetdsouza 7y ago
Author here. Why do you feel it is code golf? My primary focus when writing it was readability - I'm sure I could do it in much less than 70 lines if I had to. If you have any suggestions for improving the readability of my implementation, do let me know!
- cjensen 7y agoThe version you are comparing against is ancient and assumes a low-memory footprint. It only uses something like 10KB of data. It also has a ton more features -- like command line parsing, the ability to read from a file on the command line or stdin, and locale-specific recognition of whitespace. It's really not solving the same problem.
- ajeetdsouza 7y agoArgument parsing is hardly the bottleneck when you're scanning 1 GB of data. The reason I didn't implement the rest of the features was to keep the implementation light and readable, and I don't think a fully compliant wc implemented in Go with these patterns would be significantly slower. As for having a low-memory footprint, 2 of the 4 implementations I mentioned (one single core, one multi-core) consume less memory than wc, and still run much faster.
- aikah 7y agoHow much memory does your program uses VS the C program? Did you profile that?
- Someone 7y agoFTA: ”Our parallelized implementation runs at more than 3.5x the speed of wc, while matching its memory consumption”
- strange_aeons 7y agoYes, it's the last column in all the result tables.
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]