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.

Photo by Thomas Tastet @ Unsplash

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:

  1. Rust (573 stories)
  2. Python (375 stories)
  3. Go (332 stories)
  4. JavaScript (200 stories)
  5. C (143 stories)
  6. C++ (136 stories)
  7. TypeScript (79 stories)
  8. Java (76 stories)
  9. Ruby (57 stories)
  10. Elixir (49 stories)
  11. Haskell (48 stories)
  12. Swift (41 stories)
  13. C# (32 stories)
  14. PHP (31 stories)
  15. Zig (27 stories)
  16. Clojure (23 stories)
  17. Scheme (13 stories)
  18. F# (12 stories)
  19. Kotlin (9 stories)
  20. Erlang (8 stories)
  21. Lisp (8 stories)
  22. Lua (8 stories)
  23. Dart (4 stories)
  24. Scala (4 stories)

By the number of comments:

  1. Rust (6384 comments)
  2. Go (3394 comments)
  3. C (3027 comments)
  4. Python (2783 comments)
  5. JavaScript (1583 comments)
  6. C++ (771 comments)
  7. Zig (735 comments)
  8. Java (615 comments)
  9. Ruby (396 comments)
  10. TypeScript (341 comments)
  11. Haskell (301 comments)
  12. PHP (223 comments)
  13. Scheme (177 comments)
  14. Swift (165 comments)
  15. C# (151 comments)
  16. Elixir (133 comments)
  17. Clojure (82 comments)
  18. Lua (75 comments)
  19. Lisp (53 comments)
  20. F# (45 comments)
  21. Erlang (39 comments)
  22. Kotlin (7 comments)
  23. Dart (1 comments)
  24. Scala (0 comments)

By points:

  1. Rust (16887 points)
  2. Go (7144 points)
  3. Python (7048 points)
  4. C (5422 points)
  5. JavaScript (3644 points)
  6. Zig (2427 points)
  7. C++ (1846 points)
  8. Java (1595 points)
  9. Ruby (1044 points)
  10. TypeScript (998 points)
  11. Haskell (846 points)
  12. Elixir (751 points)
  13. Scheme (549 points)
  14. Swift (447 points)
  15. PHP (402 points)
  16. Clojure (365 points)
  17. C# (334 points)
  18. F# (331 points)
  19. Erlang (322 points)
  20. Lua (238 points)
  21. Lisp (154 points)
  22. Kotlin (34 points)
  23. Dart (14 points)
  24. 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.

(comment on Hacker News) | (follow me on Twitter)