Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow
BaselAshraf81
182 points
153 comments
November 22, 2026
Related Discussions
Found 5 related stories in 43.8ms across 3,874 title embeddings via pgvector HNSW
- Relax: JIT compiler for Rust to reduce build times adamnemecek · 180 pts · November 11, 2026 · 56% similar
- Benchfmt.rs: Bringing Go's benchmarking and benchstat workflow to Rust witcher · 29 pts · November 04, 2026 · 55% similar
- Show HN: Firenook – Firebase emulators in Rust: 40× faster writes, 10× less RAM sanjevirau · 81 pts · November 05, 2026 · 55% similar
- Actual Curl Rewrites in Rust sohkamyung · 13 pts · November 17, 2026 · 53% similar
- Porting my Electron app to Rust: 675 MB to 91 MB mohakbajaj · 43 pts · November 12, 2026 · 53% similar
Discussion Highlights (20 comments)
anttiharju
Hah, pretty neat! I recently discovered that one can apparently distribute Rust projects on npm by compiling to wasm. action-validator used to do this. Had been thinking about something like this.
diegocg
Better yet, stop writing large codebases in lenguajes that will have performance troubles.
perdy
We took this route in a Python web framework I maintain: route matching, JSON encoding, request body parsing, compression and some other specific parts moved to Rust with PyO3, everything else stayed in Python.
afdbcreid
Funny that this codebase is 62% Rust, 9% Python. And I'm a huge Rust proponent.
hendler
It's also OK to rewrite in Rust because it's not just about performance. The fast part in other Python, Ruby, etc may be written in C/C++, or call an external library, and be the vulnerable part.
egorfine
What does %LANGUAGE% have anything to do with the goal? Totally same principles apply for any other lower level language: Zig, C. While Rust is awesome, a lot of times the only apparent reason to chose Rust over C is virtue signaling. Update: like I said, Rust is awesome and has so many advantages over C it's not worth a discussion really. But again I see that many projects are choosing Rust not because of merits but simply because it's a fashion.
tialaramex
Note that this strategy only works if 5% of your software is the problem - because of Amdahl's law.
searealist
This cope was common 20 years ago with Python. It rarely worked out. It's rare that 5% of your program is taking up that large a percentage of your execution. It's usually much more spread out than that. Also, we have LLMs now. Rust should be the default for many things.
ThouYS
neat, but in my experience bottlenecks that you could solve this way are low hanging fruits and optimized away quickly. the true performance hog is like sand, spread across the system, a little bit in every place.
tomp
Or just rewrite in Numba. Most often, Python is enough.
Bolwin
The results section feels a bit like a joke. They rewrote C and C++ to Rust for performance? And something tells me C# and Java could have gotten 90% of the improvement without any rewrite. I'll have to try later today.
raincole
I'm... not so sure why you need a repo for that. It's almost 2027. You can literally just type "profile this app and find out the performance bottleneck" then "rewrite it in rust" in your agent TUI...
zodwick
I would like to argue that one could make most codebases 50% faster if rewritten from scratch with performance in mind even in the same language. Taking python as an example, one could use benefit of hindsight and make better decisions from the start ( offloading slow parts to C binaries, better DS decisions, eliminating bloat etc.. ) if they rewrite the same app in Python. This is kind of what happens when a program gets rewritten to another language ( Rust ) - better decisions are made from the start and less bloat is copied over. Yes, obviously there are exceptions to this. But most of the time it is the choices we make that make the program slow and not the language itself. It used to be that rewriting programs were almost always a dumb idea due to how much effort went into it - see: https://www.joelonsoftware.com/2000/04/06/things-you-should-... . But AI has made this argument less compelling imo. I now regularly rewrite big chunks of programs with various end goals given to the agent.
solyin
Nah. Do it in Swift.
Almondsetat
This way the trickiest parts of the codebase get reweritten in a language you don't even know... Doesn't seem a recipe for success
Dwedit
This looks very AI-generated.
osigurdson
I did an experiment to see how small and efficient I could make a desktop Linux app. One thing I learned is GPU adds a lot of memory overhead without much benefit for very basic apps.
vkaku
There is the other argument to rewrite it in something - delayer complexity where it doesn't solve an understanding problem. This has led to a phenomenal code decrease where rust primitives tackle a ton of structured case handling while keeping code simple and readable. Rust itself had an understandability issue until LLMs came along and started speedrunning parts of the Rust development process, so this argument is language AND time immaterial.
adsharma
Write in a variant of python that can be machine translated to rust. If you're using agents you might need an intermediate step. Py2many is an implementation of these concepts.
ezbie
I dont get the point of this. Developers rewrite code in rust for memory safety, not speed.