Zig crushes the competition!

Zig finished #1 leaving Rust, C, C++, and Java in the dust. Top 5 Fastest Programming Languages: Rust, C++, Swift, Java, and 90 more compared! - YouTube



I wonder how much Zig’s “-march=native”-by-default helps it out here. I think I read a Zig developer say that Zig isn’t the fastest compiled language.

1 Like

A lot of things came into play in this benchmark. The main thing being measured here is how motivated was the person who got nerd sniped into participating in this competition.

In our case it was Isaac Yonemoto (with the help of a couple more people) who, among other things, figured out that the CPU the test was run on was a 16-core machine with hyperthreading (ie which reports having 32 cores to the OS). HT is not useful when doing compute-heavy work with a focus on throughput, so he would only spawn 16 threads, while is seems the other language teams didn’t realize it would have been a useful thing to do.

Both Zig and Rust use LLVM for release builds so they ultimately are subject to the same set of optimizations. There are practical differences, but you should expect both to be pretty much equivalent.