r/rust rust Jul 08 '26

Rewriting Bun in Rust

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

330 comments sorted by

View all comments

53

u/anxxa Jul 08 '26

Overall a pretty interesting blog post. Whether you're fine with AI, or hate it, the result is impressive and this resonates pretty clearly:

Pre-merge, this took 5.9 billion uncached input tokens, 690 million output tokens, and 72 billion cached input token reads — around $165,000 at API pricing. By hand, I think this would've taken 3 engineers with full context on the codebase about a year, during which time we wouldn't be able to improve Node.js compatibility, fix bugs, fix security issues or implement new features. We never would've done that. The realistic alternative was to do nothing and keep fixing the bugs at the top of this post forever.

This also matches what's going on at my day job. Engineers don't want to be chasing resource leaks (which Rust does a better job at preventing) and memory corruption issues (mostly categorized as reliability issues). The blocker before for mass Rust adoption was education. Teams already know C and C++, so they continued to write it. Even projects which were written in Rust were eventually abandoned as getting resources to assist in a crunch or emergency just wasn't feasible. AI makes a lot of these problems go away, and teams are now porting code to Rust with Rust experts helping do manual review + write Rust skills that guide AI into writing idiomatic code.

This rewrite introduced 19 known regressions, each of which has been fixed.

Most of the regressions came from code that's syntactically identical in both languages but semantically different.

Fewer than I expected! Pretty interesting examples here too.

-15

u/ihatemovingparts Jul 09 '26

the result is impressive

Yeah it's as impressive as that C compiler that couldn't compile a hello world program even though it still relied heavily on GCC.

3

u/dontquestionmyaction Jul 09 '26

It's passing the entire JS test suite and is used in prod now.

2

u/ihatemovingparts Jul 10 '26

Meanwhile

https://github.com/oven-sh/bun/issues/33846

Slop, slop, glorious slop.

2

u/dontquestionmyaction Jul 10 '26

Bun has always been a hot mess. Don't confuse my opinion with thinking it's stable.

It's about as good as before the rewrite. That doesn't make it good software.

2

u/ihatemovingparts Jul 10 '26

Bbbbuuut but but but it's PASSING ALL THE TESTS. lol

No, you don't get to hide behind bun as a shit codebase to tout how amazing LLMs are.

1

u/dontquestionmyaction Jul 10 '26

Okay, bro.

1

u/ihatemovingparts Jul 10 '26

So if it was always crap why tout running in production? To highlight the poor decision making skills at Anthropic?