Better yet, stop writing large codebases in lenguajes that will have performance troubles.
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.
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.
Funny that this codebase is 62% Rust, 9% Python. And I'm a huge Rust proponent.
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.
[flagged]
[flagged]
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.
Note that this strategy only works if 5% of your software is the problem - because of Amdahl's law.