Playing with counting word frequencies (and the performance thereof) in various languages. See the full article for context and background: https://benhoyt.com/writings/count-words/
To run the tests and benchmarks (you'll need Go, Rust, Python 3, AWK and perhaps other tools installed). Only tested on Linux:
./test.sh
./benchmark.py
For the latest results (run on my machine), see the article's performance results section.
Thanks to these contributors for additional language versions:
- Bash: Jesse Hathaway - not included in benchmarks as it takes over 2 minutes
- C#: John Taylor and Yuriy Ostapenko
- C# (LINQ): Osman Turan - not run in benchmarks
- C++ optimized version: Jussi Pakkanen and Adev
- Crystal: Andrea Manzini
- D: Ross Lonstein
- F#: Yuriy Ostapenko
- JavaScript: Dani Biró and Flo Hinze
- Julia: Alessandro Melis
- Kotlin: Kazik Pogoda
- Lua: Flemming Madsen
- Nim: csterritt and euantorano
- OCaml: doesntgolf
- Perl: Charles Randall
- PHP: Max Semenik
- Ruby: Bill Mill, with input from Niklas
- Rust: Andrew Gallant
- Swift: Daniel Müllenborn
See other versions on Rosetta Code.