Submission timeline
2007–2026One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.
First comments on top threads
HN comment orderVery interesting, these kinds of articles are (to me) some of the best content we get on here. I'm no expert in any of the languages used except maybe C, at least I'm quick to form opinions about C code. In C, I'm not so sure that there is a well-established "idiomatic" concept, since C is not so tightly bound to a community as more modern languages. At least that's my feeling. That said, I was shocked to see that…
Re: the Rust optimized implementation, I was able to get ~20-25% better performance by rewriting the for loops as iterators, using Rust's byte range pattern matching, and a buffered writer, which seems crazy, but it's true. I chalked it up to some crazy ILP/SIMD tricks the compiler is doing. I even submitted a PR[0], but Ben decided he was tired of maintaining and decided to archive the project (which fair enough!). [0]: https://github.com/benhoyt/countwords/pull/115
I know that this is not a golf match, nevertheless, with the OP "this is what I would write in Python in real life" (eliding the module import) being: counts = collections.Counter() for line in sys.stdin: words = line.lower().split() counts.update(words) for word, count in counts.most_common(): print(word, count) I can't but resist to say what I would write in raku in "real life" (all in standard lib btw)... sub MAIN($in) { say $in.words>>.lc.Bag.sort(-*.value); } This is Unicode safe and (imho) gives…
The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.
- Breakout years
- 2
- Total points
- 819
- Total comments
- 525
100+ points or 50+ comments
reference only — not used in Hall rules or ranking
reference only — not used in Hall rules or ranking
Every submission
| Date | Title as submitted | By | Points | Comments |
|---|---|---|---|---|
| 2021-03-15 | Performance comparison: counting words in Python, Go, C++, C, Awk, Forth, RustFirst breakout · Best thread | benhoyt | 441 | 303 |
| 2022-07-24 | Performance comparison: counting words in Python, C/C++, Awk, Rust, and moreLatest 20+ point return | goranmoomin | 368 | 218 |
| 2024-05-18 | Performance comparison: counting words in Python, Go, C++, C, Awk, Forth, and Ru | fanf2 | 2 | 0 |
| 2024-06-02 | Counting words in Python, Go, C++, C, Awk, Forth, and Rust (2021) | tosh | 8 | 4 |
