logoalt Hacker News

Fast-Anything: Don't rewrite it in Rust. Rewrite the 5% that's slow

40 points • by BaselAshraf81 • today at 4:10 AM • 26 comments • view on HN

Comments

tialaramex • today at 11:15 AM

Note that this strategy only works if 5% of your software is the problem - because of Amdahl's law.

diegocg • today at 8:35 AM

Better yet, stop writing large codebases in lenguajes that will have performance troubles.

➕ show 1 reply
hendler • today at 9:33 AM

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.

perdy • today at 9:21 AM

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 • today at 9:24 AM

Funny that this codebase is 62% Rust, 9% Python. And I'm a huge Rust proponent.

anttiharju • today at 8:04 AM

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.

➕ show 1 reply
Prospernwo • today at 9:43 AM

[flagged]

manfred_singer • today at 9:16 AM

[flagged]

egorfine • today at 9:38 AM

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.

➕ show 7 replies