[image] oscar6echo:
I have added a parallel version of the algo.
Before going into parallelization, I’d suggest improvements to the algorithm. As I called out, essentially all of its time is spent in a highly suboptimal, quadratic-time, duplicates check.
A trivial usage of a HashSet already … Answer from steffahn on users.rust-lang.org
Top answer 1 of 16
17
[image] oscar6echo:
I have added a parallel version of the algo.
Before going into parallelization, I’d suggest improvements to the algorithm. As I called out, essentially all of its time is spent in a highly suboptimal, quadratic-time, duplicates check.
A trivial usage of a HashSet already …
2 of 16
3
Have you enabled optimizations? I.e. compiled with cargo build --release or rustc -Copt-level=3?
Reddit
reddit.com › r/rust › speed of go vs rust in practice/real world experience?
r/rust on Reddit: Speed of Go vs Rust in practice/real world experience?
June 23, 2023 -
Hi!
I don't want to start another language war, so let me preface this by saying I love both Go and Rust like they are my own.
That out of the way: Do you have practical/real-world experience with the performance of Go, and the performance of Rust in the same setting?
How many people worked on the codebases? Which one is newer?
I'm asking because I've got a feeling that for smaller companies, Go would in practice (not in theory) outperform Rust because Rust's design encourages the use of inefficient patterns -- like cloning a bunch where you could theoretically pass a reference
Top answer 1 of 26
69
For big/high load projects I think the discord use case is a good example https://discord.com/blog/why-discord-is-switching-from-go-to-rust BTW. I am pretty sure most small companies choosing Rust over Go is not because of performance but because of all the other set of advantages of Rust over Go.
2 of 26
66
Rust does not encourages useless cloning, it's an anti-pattern ( https://rust-unofficial.github.io/patterns/anti_patterns/borrow_clone.html ) and can be avoided 99,9% of the time, you just need time and experience to adapt to the way you develop in Rust. For the real world performance of Go vs Rust in Backend development, I have found that Rust outperforms Go by a factor of 1 to 3 times (depending on the exact use case) and uses less RAM. This performance difference should however not be taken into account if performance is not an issue for your usecases. Using Go instead of some other less performant language is already a sufficient gain in performance for most projects.
Rust vs Go vs C++
I was solving a problem on leetcode with c++ and for a very big vector, i get TLE, so the idea come to me to test with go and then i have tested with rust, still TLE. Anyways I thought rust would be faster or rarely same with go but Results C++ 0.56s to compile 14.61s to execute Go 0.23s to ... More on users.rust-lang.org
Rust vs. C vs. Go runtime speed comparison
I have written the same simple numerical program in Rust, C, Go, and was hoping that Rust runtime would be about as fast as C. It turns out that it is 10x slower than the best C compiled program, and 7x slower than the g… More on users.rust-lang.org
Is Go easier to learn than C, C++, Rust?
It's simpler than Rust / C / C++ and you're likely to get memory savings from making the switch from Node. Just as an example, I rewrote a couple discord bots I had in Node to Go for some POC on savings. Went from 90 - 120MB of RAM in the Node version to about 8 - 12MB of RAM running the Go version, along with lower CPU usage. I find it easy to learn and generally fun to code in. Definitely recommend having it in your programming toolkit. More on reddit.com
Rust vs. Go NO, it's Rust and Go.
Most developers are polyglots. That's really quite common. Unless you're experienced, I would advise against trying to learn two languages at the same time, especially while trying to learn Rust. That's a good way to get frustrated and not actually retain what you're trying to learn. More on reddit.com
Videos
07:25
Rust vs. Go (Golang): Performance (Fastest Frameworks + PostgreSQL) ...
r/golang on Reddit: Go vs Rust: I Was WRONG About Performance
03:31
Rust vs. Go (Golang): Performance 2025 - YouTube
03:54
Rust vs. Go (Golang): Performance (Only Standard Library) - YouTube
r/golang on Reddit: Rust vs. Go in 2026 | Article Review
03:04
Rust vs C++ Performance: Can Rust Actually Be Faster? (Pt. 2) - ...
Top answer 1 of 15
6
There is no point in computing the difference on each iteration. You can just search for the minimum and maximum, and take their difference. It should fully vectorize and be blazingly fast. There is also no point in hand-rolling the search, the standard (Iterator::max](Iterator in std::iter - Rust) …
2 of 15
5
I think there's an O(n) algorithm for this problem that will be much faster than any of these.
That said, all three of these languages should be in the same ballpark as far as execution time is concerned. Are you enabling optimizations in C++ and Rust?
JetBrains
blog.jetbrains.com › rust › 2025 › 06 › 12 › rust-vs-go
Rust vs Go: Which One to Choose in 2025 | The RustRover Blog
February 17, 2026 - For instance, a benchmark by benchmarks game shows that Rust implementations tend to have lower memory use and are often faster in computation-heavy tasks compared to Go. For example, Servo, a high-performance browser engine developed by Mozilla, leverages Rust’s ability to manage memory efficiently to improve parallelism and ensure safety, significantly enhancing browsing speed.
Bitfield Consulting
bitfieldconsulting.com › posts › rust-vs-go
Rust vs Go — Bitfield Consulting
February 15, 2026 - Rust’s clever compiler produces optimised code that runs as fast as the underlying hardware will allow, equalling the performance of C++ or assembly language programs without sacrificing memory safety. Control. To get the most out of modern CPUs, programmers need to get “close to the metal”, and Rust offers low-level control and excellent interoperability with C/C++ libraries. Go is an ideal language when the situation demands:
Programming Language Benchmarks
programming-language-benchmarks.vercel.app › go-vs-rust
Go VS Rust benchmarks, Which programming language or compiler is faster
* (You may find time < time(user) + time(sys) for some non-parallelized programs, the overhead is from GC or JIT compiler, which are allowed to take advantage of multi-cores as that's more close to real-world scenarios.)
Benchmarks Game
benchmarksgame-team.pages.debian.net › benchmarksgame › fastest › rust-go.html
Rust vs Go - Which programs are fastest? (Benchmarks Game)
Rust Go - Which programs have fastest performance?
Rust Programming Language
users.rust-lang.org › code review
Rust vs. C vs. Go runtime speed comparison - #31 by steffahn - code review - The Rust Programming Language Forum
December 20, 2023 - I have written the same simple numerical program in Rust, C, Go, and was hoping that Rust runtime would be about as fast as C. It turns out that it is 10x slower than the best C compiled program, and 7x slower than the g…
DZone
dzone.com › articles › a-detailed-comparison-between-top-programming-lang
DZone: Programming & DevOps news, tutorials & tools
July 24, 2020 - Enterprise solution for all your Social Q&A needs.
Google Groups
groups.google.com › g › golang-nuts › c › WBnqwLjzTmE
Achieving C/C++/Rust comparable performance with Golang
December 14, 2022 - Go is a high performant garbage collected language, (considered) memory safe programming language, and as such its performance may not be comparable with other languages such as C/C++/Rust under certain application scenarios.
CodiLime
codilime.com › blog › software development › backend › rust vs. go — what do you need to know about these languages? - codilime
Rust vs. Go — what do you need to know about these languages? - CodiLime
April 1, 2022 - Golang uses a garbage collector. Rust introduced an innovative feature called ownership and borrowing. This is a concept where every object has an owner who can give it to someone else or borrow it. Furthermore, in Rust we can create a ONE AND ONLY mutable reference or multiple immutable references. With this approach, Rust resolves common memory errors without a garbage collector, which makes Rust’s performance higher than that of Golang.