I was wondering if programs used in the real world are mostly written/built in Rust or Go? How to create a real world statistic to compare ?
Homebrew package manager
I found that Homebrew lists the dependencies of the package like this.
$ brew info eza
==> eza: stable 0.18.13 (bottled)
Modern, maintained replacement for ls
https://github.com/eza-community/eza
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/e/eza.rb
License: MIT
==> Dependencies
Build: pandoc โ, pkg-config โ, rust โ
Required: libgit2 โ
==> Analytics
install: 12,792 (30 days), 38,295 (90 days), 68,375 (365 days)
install-on-request: 12,790 (30 days), 38,293 (90 days), 68,375 (365 days)
build-error: 0 (30 days)
The dependencies of eza to build are pandoc, pkg-config and Rust. So, I can get all software packages in Homebrew and query every package to get its dependencies, then calculate the number of packages which depends on Go and others on Rust.
I was wondering if I should execute system commands of brew list
and brew info <pkg-name>
, but fortunately, Homebrew has a json file containing all Homebrew Core Formulae.
gobrew
So, I created a simple Go program named it "gobrew" to get the JSON API, then parse it, and count all Go-based software packages.
I made gobrew more general, so, you can use it to get the number of packages written in Ruby by this command gobrew -l ruby
. You can specify any programming language or library or build system or runtime.
Statistics on April 26, 2024
The number of packages written in Go is 957. The number of packages written in Rust is 524. That means Go is the most used in software distributed by Homebrew package manager for production by far.
$ ./gobrew -l go
957
$ ./gobrew -l rust
524
You can try it yourself via gobrew on GitHub.
Here is a chart to help distinguish the difference in the count of packages.
other programming languages
I used this command to count packages written in these programming languages for me.
$ ./gobrew -l zig
6
Here is a table of programming languages (I thought of) and their packages count.
Language | pkg count |
---|---|
python\@3.12 | 718 |
python\@3.11 | 67 |
lua | 47 |
ruby | 27 |
ocaml | 26 |
perl | 25 |
php | 20 |
cython | 12 |
Zig | 6 |
build systems & libraries & runtimes
I used the following command to count packages which use the build system or runtime to get build or run.
$ ./gobrew -l cmake
1011
Here is a table of build systems, libraries and runtimes (I thought of) and their packages count.
build system or runtime | pkg count |
---|---|
pkg-config | 1447 |
cmake | 1011 |
autoconf | 455 |
automake | 435 |
libtool | 366 |
ninja | 253 |
meson | 213 |
node | 189 |
gcc | 75 |
python-setuptools | 75 |
llvm | 30 |
luajit | 22 |
my opinion
I think of Rust as a great language for low level programming such as operating system modules and device drivers. And I think of Go as the perfect backend programming language and CLI apps. I think that's why Go is almost 2x more used to create apps distributed via Homebrew compared to Rust.
I think Go is more useful for most cases, but there are other specific cases suitable more for Rust and Zig (which I think will succeed and get popular).
I hope you enjoyed reading this post as much as I enjoyed writing it. If you know a person who can benefit from this information, send them a link of this post. If you want to get notified about new posts, follow me on YouTube, Twitter (x), LinkedIn, Facebook, Telegram and GitHub.
Top comments (2)
I am not familiar with
Go
, but I thought I should point out thatGo
is 6 years older thanRust
. That might possibly be a contributing factor why there are more usage ofGo
thanRust
at the moment?You might like this article: youngwonks.com/blog/go-vs-rust