Relative popularity of programming languages on Hacker News
As a long-time Hacker News reader, I've seen trends come and go. One of those trends is popularity of programming languages, manifested through the number of stories referencing a language.
Examples include “Building a Cache in Elixir”, “Helix: Neovim inspired editor, written in Rust” or “Text formatting in C++ using Libc++”.
Since these “in $LANGUAGE” articles come up fairly often, I was curious to see what we can glimpse about programming language popularity just by counting them. This is easy to do using HN Search API provided by Algolia.
Methodology
I used it to search for stories in the past year, where the phrase “in $LANGUAGE” appears in the story title. The search included C, C++, C#, Clojure, Dart, Elixir, Erlang, F#, Go, Haskell, Java, JavaScript, Kotlin, Lisp, Lua, PHP, Python, Ruby, Rust, Scala, Scheme, Swift, TypeScript, and Zig languages.
I also included Racket Scheme and added its numbers to Scheme. I'd have included Common Lisp as well, but there were no stories mentioning it explicitly in the title in the past year. Also, since C would match both C++ and C# results in this simple string search, I deduplicated the results to get the correct count.
I ranked the languages in three ways: by the number of stories, number of comments, and sum of points. The results were fairly consistent across all three metrics.
If you're interested in running this yourself, this is the script I used (you'll need the requests
package to run it). It downloads and caches search results as JSON in /tmp/hn
, sorts the languages, and prints the results.
I ran the script on October 12th, 2022.
And the winner is ...
... Rust, by a wide margin. Here are the full results:
By the number of stories:
- Rust (573 stories)
- Python (375 stories)
- Go (332 stories)
- JavaScript (200 stories)
- C (143 stories)
- C++ (136 stories)
- TypeScript (79 stories)
- Java (76 stories)
- Ruby (57 stories)
- Elixir (49 stories)
- Haskell (48 stories)
- Swift (41 stories)
- C# (32 stories)
- PHP (31 stories)
- Zig (27 stories)
- Clojure (23 stories)
- Scheme (13 stories)
- F# (12 stories)
- Kotlin (9 stories)
- Erlang (8 stories)
- Lisp (8 stories)
- Lua (8 stories)
- Dart (4 stories)
- Scala (4 stories)
By the number of comments:
- Rust (6384 comments)
- Go (3394 comments)
- C (3027 comments)
- Python (2783 comments)
- JavaScript (1583 comments)
- C++ (771 comments)
- Zig (735 comments)
- Java (615 comments)
- Ruby (396 comments)
- TypeScript (341 comments)
- Haskell (301 comments)
- PHP (223 comments)
- Scheme (177 comments)
- Swift (165 comments)
- C# (151 comments)
- Elixir (133 comments)
- Clojure (82 comments)
- Lua (75 comments)
- Lisp (53 comments)
- F# (45 comments)
- Erlang (39 comments)
- Kotlin (7 comments)
- Dart (1 comments)
- Scala (0 comments)
By points:
- Rust (16887 points)
- Go (7144 points)
- Python (7048 points)
- C (5422 points)
- JavaScript (3644 points)
- Zig (2427 points)
- C++ (1846 points)
- Java (1595 points)
- Ruby (1044 points)
- TypeScript (998 points)
- Haskell (846 points)
- Elixir (751 points)
- Scheme (549 points)
- Swift (447 points)
- PHP (402 points)
- Clojure (365 points)
- C# (334 points)
- F# (331 points)
- Erlang (322 points)
- Lua (238 points)
- Lisp (154 points)
- Kotlin (34 points)
- Dart (14 points)
- Scala (7 points)
Hacker News loves Rust
Go, Python and JavaScript are quite popular, but Rust absolutely blows the competition out of the water. It had almost as much stories and comments as the languages in second and third place combined, and was awarded even more points.
If you're a regular HN reader, this isn't surprising. As a modern language with passionate community, Rust is invariably mentioned in most conversations about languages in general, and stories about using Rust for a new project or in a new are always exciting.
And I'm not even counting the “Rust in the Linux kernel” theme, which alone got around 600 points across various stories in the past year.
The new kid on the block is ... Zig
What did surprise me is the relative popularity of Zig, a fairly young language with still a relatively small comunities – I'll be sure to keep an eye on it.
—