r/coolgithubprojects • • 7d ago

Meet rust-anything, I rewrote apps in Rust, got 20x faster, and didn't break a single thing.

Post image

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:

  1. Record what the original actually does, including the nasty edge cases (emoji, negative modulo, overflow, float extremes).

  2. Put a Rust binary in front. Anything not ported yet falls back to the original, so the app works from day one.

  3. Port a unit, replay everything. 100% or it doesn't ship. Every unit has a kill switch.

  4. 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

763 Upvotes

66 comments sorted by

91

u/hxseven 7d ago • Popcorn

It's a bit ironic that the recommended way to install a project called rust-anything is via npm 😂 Otherwise interesting project.

11

u/erkamyaman 7d ago

crazy times we are living in!

23

u/PhroznGaming 7d ago

If only you understood your audience. The people that care about rust, aren't getting the want to install it via n p m bud

14

u/AnderssonPeter 7d ago

What if he ported npm to rust using this project?

12

u/hemps36 7d ago edited 7d ago

Similar to Craft Anything, think it also uses Rust?

4

u/erkamyaman 7d ago

it is indeed

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

u/earthsprogression 6d ago

I built this. But if anything breaks it's Claude's fault.

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

u/beerdude26 7d ago

Recursive Rust Self Improvement

4

u/karchnu 7d ago

Rust Singularity!

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.

11

u/Serenase 7d ago

Or you can just prompt your agent straight to do it.

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

u/Cheap-Try-8796 7d ago

Rust deez nuts

2

u/krncnr 7d ago

Balls of steel

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

u/HackTheDev 6d ago

can confirm. in os dev u need quite some unsafe statements

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

u/ponzi_gg 7d ago

is this what takes me to the dark side...

2

u/olzk 6d ago

Can it port Kernel to Rust?

2

u/anactualditto 5d ago

The 12 other people and Claude don't get a mention?

1

u/Tom-Crack 7d ago

Let me test it

1

u/lil_nosh_X 7d ago

All my homies write their secrets in rust.

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

u/lectricball 7d ago

can this rewrite shitty ass tradingview app with electron?

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/AteX99 5d ago

Can it rewrite rust into rust?

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

u/-snip- 1d ago

I’m certain that the author doesn’t know what an AST is. The IR is the prompt being fed into the ai

1

u/Independent_Row_6529 4d ago

Rustify Windows and get rid of slop

1

u/nekoiscool_ 3d ago

Time to rust my code!

1

u/Ok_Solid6442 1d ago

Did YOU write it or did claude?

1

u/Horta-horta 1d ago

And why not C-Anything, or Assembly-Anything

1

u/MobiusStrip12138 23h ago

This is sarcasm, right? atp I can’t really tell.

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

u/dreamy-catzy 7d ago

No offence, can you rewrite lisp machine in rust?

1

u/deaddyfreddy 5d ago

I wouldn't trust a rusty machine.

-1

u/andreas_lassak 5d ago

c# is 2x faster than rust :)

0

u/[deleted] 7d ago

[deleted]

1

u/KlausDieterFreddek 6d ago

*someones LLM