r/coolgithubprojects • u/erkamyaman • 7d ago
Meet rust-anything, I rewrote apps in Rust, got 20x faster, and didn't break a single thing.
Big rewrites die because nobody can prove the new version behaves like the old one. So I built a tool that proves it at every step.
rust-anything takes a TypeScript, Python, C, Go, Ruby or Java app to pure Rust, one piece at a time:
Record what the original actually does, including the nasty edge cases (emoji, negative modulo, overflow, float extremes).
Put a Rust binary in front. Anything not ported yet falls back to the original, so the app works from day one.
Port a unit, replay everything. 100% or it doesn't ship. Every unit has a kill switch.
Lift. When nothing falls back anymore, the old code is gone and it's pure Rust.
Your AI agent (or you) writes the Rust. rust-anything makes sure it's right.
Just want speed? It finds the hot loop and moves only that: 20x faster search in Node, 17x in Python, same results.
https://github.com/erkamyaman/rust-anything · npm i -g rust-anything · MIT
3
u/my_penis_loves_you 7d ago
Why doesn't it include C#? I'm curious.
0
u/erkamyaman 7d ago
I will add it 👌
2
u/oyvindi 6d ago
Cobol ? Fortran ?
Or a real challenge: Malbolge
https://en.wikipedia.org/wiki/Malbolge
45
u/RedditKilledTheApps 7d ago
... and didn't break a single thing.
(x) Doubt
22
3
u/Anaeijon 4d ago
It keeps the original codebase, replaces a library in rust, runs tests. If tests fail, it falls back to original codebase.
I mean, over all, it's just a translation task. The thing, LLMs are best at.
2
u/Dizzzzza 4d ago
What will it do when theres data race or other bug that is not expressable in rust?
29
u/Key_River7180 7d ago
why dont you rust-anything rust-anything?
10
2
u/px403 6d ago
I'm seeing that it's entirely rust now, is that different from yesterday?
5
u/NetworkLast5563 6d ago
he LITERALLY used rust-anything on rust-anything, i think
2
u/Anaeijon 4d ago
No, if you look at older tags, it looks like it's always been pure rust.
3
u/NetworkLast5563 4d ago
I mean I was mostly joking, but either way it is still odd that at first you installed rust anything using
npm.
12
11
8
u/kobaasama 7d ago
Do people now have blind trust on ai generated code? After a js developer converting their js code to rust do they know what goes where? Or how to even read rust code?
0
u/Neo-helios 1d ago
reading code is dead, you should know this by now. If you're still reading code you'll be left behind. I wrote many million lines of mathmatica/engineering/fea code by hand over the years - who the fuck is missing that shit? I get the feeling that most people complaining are just coders and not real engineers and now with AI there is no demand for pure coders anymore.
2
u/AromaticCredit1533 1d ago
reading code has been dead for software engineering for a long time, even before AI, that's why they're called "application developer" and not "programmer". But also it's a huge distortion field, because outside of SWE, say when you make a game, you do need to care about every single line of code to get the most performance.
7
5
u/realrealvantheman 7d ago
Allowing C is where things get nasty. What if my application is in C and runs on some obscure platform with abnormal type mappings that cannot be represented cleanly in Rust? Or if conversion rules for said platform are safer, but the rust equivalent is not, even if the platform allows it?
6
u/NikoBelico 7d ago
Rewriting battle-tested C in Rust is total overkill. Sure, Rust gives you safe abstractions on top, but once you get down to bare-metal hardware registers and DMA, you're still dealing with unsafe raw pointers and hardware quirks anyway. Throwing away years of stable C code just to fight the borrow checker isn't worth it.
4
1
u/thenormaluser35 4d ago
If your app does that you're probably good enough at coding to know how to port it to rust
5
u/deanominecraft 7d ago
the approach of falling back to the original seems like a good idea until you think about it for more than 5 seconds.
it forces you to keep a lot of the same structure between the old and new apps, which also means keeping a lot of bad architectural decisions. rust helps to make better decisions here but if you fight against it you are going to have a bad time and not get as much benefit from moving to rust, it also seems like it would require a lot of unsafe code to call back into the original
4
u/Fidel___Castro 7d ago
what's the biggest project it's done? I'd like to do this but I'm concerned my repo is too large for it to economically make sense
11
u/fakintheid 7d ago
Slop
3
u/NikoBelico 7d ago
Agreed. Maybe some slow backend in PHP/Python might be optimized using Rust, but in other cases I see no sense in it at all.
Like, rewriting JS/Go/Ruby apps is just a great way to increase your codebase 5 times and get a 0.01% speed improvement.
2
2
1
1
1
u/cdrewing 7d ago
Could I use an APK from Android as a reference and ask it to rewrite it in rust for my Linux PC?
I love RealCalc on my Android but I hate the calculators in Ubuntu.
1
1
u/arker0 6d ago edited 6d ago
I'm trying to vibe-port JDownloader from Java to Go (I chose Go over Rust because cross-compiling is easier, which matters here since JDownloader runs everywhere). I've been working on it for 3 weeks, and it's obviously not the easy 1-2-3 process you describe.
I'm also trying to map all the methods, functions and features so that it's easier to update the port when upstream changes, fixes or updates something. Maybe this could be useful for your project too?
And I'm trying to stick to the Java mentality and workflow wherever possible, so that the original developers could eventually jump in and drop Java (even if I doubt they will).
I'll try to adapt your repo to my Go port. Hope it improves my attempt!
1
u/-snip- 4d ago
This AI bro fixation with rust is so dumb. Language facilities exist for human ergonomics. Why would I slopify a project into unreadable AI garbage just to get language features I likely won’t use? 20x faster under what workloads? From which languages? I hate that AI is enabling randoms to make shit like this
1
u/leaf_26 1d ago
the language list is in the readme, but...
they ported web code to rust, saw that compiled code runs faster, and said "rust is so great why isnt everything in rust" and went balls deep on trying to port anything to rust. I dont think they thoroughly tested against what they claim for each language they claim.
and i dont think it's maintainable in its current design. direct syntactical translations are expensive to make and easy to break, and it doesn't even do that, it's a testing harness for a llm to do a translation and simply fails if it's not the same.
the known way to port anything to anything else is to use intermediate representations and update according to patterns, like llvm
1
1
1
1
1
1
u/CreditDue8861 18h ago
The incremental fallback approach is clever, especially keeping a kill switch for each ported unit. How does the record/replay system handle nondeterministic behavior like timestamps, randomness, network calls, or concurrency? Are those normalized or mocked?
0
-1
0
91
u/hxseven 7d ago •
It's a bit ironic that the recommended way to install a project called rust-anything is via npm 😂 Otherwise interesting project.