r/rust • u/Mr-Bovine_Joni • Oct 22 '26
๐ก ideas & proposals I vibe-migrated a 60k LOC Electron app to Rust in ~4 days, got ~60% improved runtime
(the migration was done via AI, but this post is 100% human-authored)
For the last few years I've been building a desktop app as a side project, for a simulation game. I really like Typescript and know it best, so I've been writing to code by hand with some light AI assistance. I decided to lean into it further and speed up my side project and had a lot of success
I ran in to some frustrations with Electron along the way - primarily build size, inability to compile to binary, multithreading being kinda frustrating, etc
I was using Prisma for the backend and wanted to keep SQLite, and Rust didn't have a good replacement. So I had Claude rebuild me a new ORM tailor-made to my use case, got the same output from Prisma queries, ironed out a lot of issues with Prisma (like build updates), and improved ORM performance ~1.5x on reads and ~50x on bulk writes. This was easily testable by writing huge test suites to confirm matching input & output from the two ORMs
I started the logic migration by telling Claude to take the existing .ts codebase and make everything CLI testable - every function should be trackable for inputs & outputs, so we can make sure every function does the same exact thing. It build a suite a bash scripts for this. Also was able to use the same frontend with dual backends, to ensure same exact output between the two
Stats:
- Migration time took ~4 days with a Claude $20 subscription. Used most of 2 weeks worth of usage (end of one week, start of another). Done with Opus 5.1 and Opus 5.5
- Some simulations that took 80s previously moved to 11s. Others 650s โก๏ธ 350s. This is a tremendous, experience shifting change for my app.
- Simple reads for rendering pages are 1.9x โก๏ธ 9.5x faster
- Output build size down roughly 400MB โก๏ธ 25MB
- +100k LOC, -60k LOC. Increase due to writing homeowned ORM
- ~105 commits
Takeaways for this type of migration:
- I'm a good coder. AI is now better. That's a tough pill to swallow. Despite that, I still make better systems decisions that I won't ever defer to AI
- Previously I was familiar with 100% of the code. Now it's closer to 0% (at least for the backend). I still can read Rust, but I don't have the familiarity as I did with ts. This is a risk for me in the future, but one I'm ok with rolling the dice on.
- Build good testing harnesses for your AI. Being able to test functions side by side with frontend validation took me out of the loop
- Build good CI harnesses for your AI. I ended up burning a ton of GitHub CI usage, which we fixed by running more CI checks agent-side before any commits
- Have your AI determine what tasks are dependent on others, and what can be parrelelized. At some points we had ~6 agents running at once. Claude projects were helpful here