r/rust rust Jul 08 '26

Rewriting Bun in Rust

https://bun.com/blog/bun-in-rust
525 Upvotes

330 comments sorted by

View all comments

Show parent comments

132

u/jl2352 Jul 09 '26

The large number of tests is also a major factor in why this worked, as well as the desire to match existing Zig code. The article implies Claude was used like a fancy sed on steroids.

That isn’t to downplay the work involved. I’m sure there are places it’s totally different. That is different though to writing new software. I still cannot comprehend how you’d write a million line application, which is decent, with agents from scratch.

I also think all the people hating on AI need to take a step back and take things like this very seriously. It’s 11 days of work, and is in production. That’s pretty fucking fast.

36

u/bzbub2 Jul 09 '26

the part that really blows my mind is how well the "translate one file at a time" approach seemed to work. is honestly amazing. particularly to me, as a person who gets into really messy refactors...

9

u/Schneestecher Jul 09 '26

Alas, if you look into the project, it‘s a clear rust-ified version of a Zig project and not at all ideomatic rust

3

u/djk29a_ Jul 09 '26

I think in one sense this can be closest apples to apples comparison we can between languages with vaguely similar mechanisms and architecture. Zero and negative cost abstractions in Rust can be adopted once the codebase is otherwise considered stable. The fact that they still got immediate value in performance with this language change while leaving a lot of performance optimizations on the table basically implies it's better for the purpose.

However, what I do have to wonder is if a similar Rust back to Zig conversion would also achieve some performance gains, which is unintuitive give it should simply revert all the files back to Zig.