I ran the same three programs in six languages. Rust did not win all of them.
"Rust is fast" is true often enough that people stop checking. While building Ruststudio (an IDE for Rust, written in Rust) I wanted a page that tells newcomers when Rust is worth the learning curve, so I measured instea
"Rust is fast" is true often enough that people stop checking. While building Ruststudio (an IDE for Rust, written in Rust) I wanted a page that tells newcomers when Rust is worth the learning curve, so I measured instead of repeating slogans.
The setup: three small programs, written the same way in Rust, Go, C#, Java, Node and Python. Each prints a checksum, and all six languages print the same one, so they did the same work. Each ran three times at below-normal priority; I report the median. Machine: i7-10750H, 12 logical cores, Windows 11. Rust 1.93, Go 1.26.5, .NET 10, OpenJDK 17, Node 22, Python 3.13. Start-up time is included, so Java and C# pay for starting their runtime.
Speed (seconds, lower is better)
| Rust | Go | C# | Java | Node | Python | |
|---|---|---|---|---|---|---|
| Mandelbrot 800x800 | 0.09 | 0.09 | 0.17 | 0.18 | 0.15 | 2.74 |
| Primes below 20 million | 0.16 | 0.18 | 0.23 | 0.24 | 0.26 | 1.15 |
| Word count, 3 million words | 0.81 | 0.43 | 0.47 | 0.55 | 0.60 | 1.71 |
On the two number-crunching programs Rust and Go lead. Python is 30 times slower on the Mandelbrot set.
Now look at the last row. Go and C# beat Rust on the word count, nearly twice as fast. The program creates millions of small strings and looks each one up in a hash map. Rust's default hash map uses an attack-resistant hash, and the program used the system allocator, which loses to the allocators built into Go and .NET for many tiny objects. A fast hasher helped only a little (0.75 s), so most of the cost is allocation. Rust gives you the control to fix that (reuse buffers, avoid the allocation, choose another allocator). It does not do it for you.
Memory (peak MB)
| Rust | Go | C# | Java | Node | Python | |
|---|---|---|---|---|---|---|
| Mandelbrot | 3.9 | 5.6 | 21.0 | 38.0 | 30.7 | 10.7 |
| Primes | 23.0 | 25.5 | 39.6 | 55.8 | 47.9 | 48.8 |
| Word count | 8.0 | 13.0 | 35.3 | 99.1 | 49.5 | 16.2 |
Rust used the least in all three. There is no garbage collector, so memory comes back when a value goes out of scope.
What you ship
The Rust benchmark became one 146 KB executable that needs nothing installed. Go: 2.4 MB, also standalone. C# and Java need their runtimes; Node and Python need the interpreter and their packages.
The bugs that never run
I wrote the same small bug in each language. A missing value used as if present, use after move, a reference that outlives its target: in Rust all three are compile errors. In every other language the first one crashes at run time.
The one that surprised me: eight threads adding to one counter with no lock. Rust refuses to compile it. Go printed 244,043, C# 207,098 and Java 117,040, where the right answer is 800,000. No error, and a different wrong total each time. (Node is single threaded, and Python's global lock happened to hide it in my run. That is luck, not a guarantee.)
What Rust costs
It is wordier: 83 lines against Python's 41. Release builds compile slower. Ownership takes weeks to feel natural. Some ecosystems (mature GUI toolkits, enterprise libraries) are thinner than Java's or .NET's. And integer overflow is not stopped: a release build wraps like everyone else's.
So when?
Choose Rust when a crash or a security hole is expensive, when you need predictable latency without GC pauses, when you want one small executable, or when the code will live for years. Choose something else for throw-away scripts, or when your team already ships fast Java or .NET and the hot path is not critical.
Everything here is regenerated by scripts. The full write-up, with the bug table and the method, is at https://ruststudio.org/why-rust. These are small programs on one PC: an illustration of trade-offs, not a verdict. If you think a program is unfair to your favourite language, send a fix.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.