How is the Bun Rewrite in Rust going?

401 points301 comments10 hours ago
Jarred

Bun’s Rust rewrite shipped in Claude Code over a month ago and barely anyone noticed. Claude Code is widely used. The Rust rewrite is going well overall.

In the Bun v1.4 video, I promised a certain number of newly passing Node.js tests were added to force us to improve compatibility, and that number is not true yet. The release is delayed until it is true. The PRs to make it true are up but not merged yet. Most likely next Tuesday we’ll do the release of 1.4.

show comments
SquareWheel

I'm not sure how much insight we can glean from looking at the number of commits and release cadence here. In the aftermath of such a major refactor/rewrite, I would expect it to take some time to get back up to their usual development speed.

Jared and the other developers are new to the Rust codebase, even if the structure is largely familiar. They're also likely focusing on other priorities right now such as tracking down instances of 'unsafe', rather than making user-facing changes (which might encourage a release).

Bugfixes could encourage rapid new releases, but perhaps the rewrite simply hasn't been very buggy? As far as I know, those on the canary channel haven't reported any major issues, or even really noticed the change. So perhaps there's little reason for new releases right now, as the team slowly churns through the backlog.

> P.S. Anthropic’s C compiler and Cursor’s FastRender web browser haven’t had any commits for months.

I always assumed those were just experiments in capability, and weren't meant to be ongoing projects. I would hope that nobody is using them directly today.

show comments
benjiro29

I really do not understand how software developer think anymore. Using a LLM to translate a project in a short time, is by itself incredible. Just like one-shot whatever office clone.

But what makes software is not the fast creation of a "product" but that actual development of its features. Figuring out how everything needs to work together, fixing the bugs, and the o so boring UI work.

I have used LLMs to create stuff like word clones just for fun. It was a disaster. Sure, it had the basic functionality. But the moment you started with page structure (harder then one non-stop scrolling page), tables, images, rotating, and so many details that make up just the basics of word. Not even the extended functionality. You see every LLM just fall on its face.

Sure, i can clone sqlite from c to rust. Hell, i may even get it to do all the tests 100%. But there is a 99% chance that the clone will be slower, as it lacks the years of optimizations from the original language. There will be new bugs because of the language changeover. There is a need for future support and fixes.

People threat software like its something it is not. But unlike the past where your clients question your sanity for charging 100k for a piece of software. Not understanding its not just about writing the code. Now those expectation are even more pushed forwards, because of articles like this.

I constantly see software being published on reddit that does X, Y, Z only for the authors to abandon it as fast as they vibe coded it. Because fixing bugs is NOT sexy. Even with a LLM at your fingertips. Dealing with nagging users, is not sexy. Dealing with security issues, is NOT sexy. Dealing with data structure / databases, especially as your system changes ... you get the point.

Not understanding to the core the software you wrote, is going to exploded in your face.

This is why these stupid "we rewrote X into Z with a LLM in Y days" mean nothing. Its one thing to get a head start using this trick, its another to actually learn the code of your rewrite. And dedicated the time into maintaining the port, growing it, fixing it. This is where a lot of software fails. But now this crap is out there, instead of the maintained version of Zig, now we have a unmaintained Rust version that clouded the airwaves because if people now search for it, those articles "X in Z days" will pop up.

What have we become ...

show comments
bendmorris

As a comparison point, someone decided to try to fix the issues in the Zig original and is now claiming sub-second build times, plus fixed bugs, by modernizing the codebase and sticking with best practices - indicating that all of the issues that justified the rewrite were self-inflicted and addressable.

https://ziggit.dev/t/buz-a-drop-in-replacement-for-bun-using...

I have no skin in this game, and the Zig version is also using LLMs if that helps take the culture war out of it. But, it has always been true in my experience that someone who really understands a problem space can outcompete someone who just throws resources (in hundreds of thousands of dollars of token spend) at it.

show comments
Tehnix

The bun rewrite inspired me to be much more aggressive on porting code, rewriting code, or vendoring external dependencies to tailor them specifically to our needs in ways that doesn’t make sense to upstream.

I feel like it made me generally more ambitious in what I’d throw at a coding model, but also made me focus a lot more on our testing harness and keeping a lot of it at the boundaries outside the language specific parts.

Having been part of several huge rewrites before, some multi-year long, I definitely would consider bun’s rewrite an enormous success. To keep such a level of test and feature parity, and add improvements on top of it, is a massive engineering feat.

abalashov

I did suspect that the triumphalist pronouncements, and even the seemingly honest and forthright deep dive, were a little premature.

This is a key problem with LLM exuberance: it's very tempting to trade on decades of experience in software using LLMs, because one is tired of typing and manual figuring-out, it seems to work if you're competent, and the payoff is essentially immediate. The real bill comes in the mail much later.

show comments
pu_pe

I am fascinated by the discourse around this Bun rewrite. I read a lot of drama and personal accusations, there are pieces like this one trying to extract clues, and it seems everyone has a deeper ideological concern behind whatever they are trying to say. For this article, it seems to be skepticism towards AI and how successful it can be at replacing programmers. Other takes, like the one from the Zig maintainer, were also along those lines but more about the open source ethics and the future of that in a LLM world.

I am mostly bullish on AI capabilities, so from my perspective I don't see why we should be skeptical that frontier LLMs guided by experienced devs can translate whole libraries like that. Good follow-up questions would be how expensive it currently is to do so, and whether we will see people branching into all-in on AI versus no-AI camps as happened in this case.

show comments
losvedir

I'm not sure Anthropic even cares about "releasing" the next version. The rust one has been in use in Claude Code for more than a month now, used by millions of people, and that's as far as they probably really worry about it. They bought Bun for Claude Code and I doubt the open source project matters to them otherwise.

show comments
xiphias2

Everybody who has rewritten software understands the current phase: it mostly works, but there are always things to fix to make sure that there are no regressions, and the pressure is huge for any release.

I still believe it was the good decision, but I also know that I wouldn't be the first person to run the release in prod.

I think Jarred should start making release candidates instead of releases to take some of the pressure off.

simonw

This article could increase its credibility by being updated to acknowledge that Bun-on-Rust has been live in Claude Code itself since June 17th, and available as a canary release since it landed on main.

Rewrites of this scale certainly justify long canary release periods!

show comments
reliabilityguy

Many repeat the point of “$165k is cheaper than team of multiple engineers working on the rewrite for a year”, which I think is flawed — the team of engineers would have produced idiomatic rust, and it would take probably 100k+ of tokens more to make the bun in rust idiomatic rust.

show comments
CrzyLngPwd

Just a couple more 100hr weeks of debugging, and the last 80% will be done :-)

show comments
orsenthil

I think, we all are phrasing this wrong. Bun was <strike>rewritten</strike> retooled in Rust by AI with only ensuring integration tests and usage tests succeed. That's similar how to a C program was compiled to binary or Typescript was transpiled to Javascript and run. We didn't make a very big deal of it then, and I think, we should see this operation as a similar higher level source to source translation, which machines have been doing.

Writing code is a different thing.

show comments
rao-v

I don't quite understand the focus on the token cost of this rewrite. Obviously, we should examine if this rewrite is good, effective, good for the product etc., but the token cost seems ... not important?

The marketing value of this to Anthropic (if Anthropic even cares, this might just be the Bun team selling past the close) is to show that such a rewrite is possible and delivers engineering value. If exactly this project is $800K today, it'll be $200K and then $80K soon, so it's not so important to the story that it's cheap, just that a big "cool" rewrite is possible, and delivers velocity to the buisness.

show comments
smb06

I do believe they were trying to use CodeRabbit to review their re-written code. https://www.coderabbit.ai/blog/ai-can-migrate-your-entire-co...

coderdatapoint

I just got a github notification on an old Bun bug report when it was still coded in zig. The bun-bot had completely solved the bug in the new rust codebase, added comprehensive tests, did the write up, pushed the commit all without human interaction. The fix looked sound and changed minimal lines of code. This AI is the real deal. Programmers should be concerned.

podgorniy

> I hadn’t seen the numbers for the CI/CD costs of Buildkite, and as you might have noticed from above, some PRs were written by Anthropic employees.

The leaked code of the claude had switch flag where claude pretends to be employee. You can't trust/expect that those PR's were authored by people.

show comments
muglug

This post doesn’t make sense. It was rewritten in Rust. The rewrite itself is complete (no more Zig).

Various people have claimed that Bun in Zig had a lot of tech debt. If they’re to be believed, it seems natural to assume the rewrite does, too. Perhaps all this activity is paying down some of that debt.

show comments
pianopatrick

At what point should I trust projects like this?

I've heard stories of LLMs changing tests to get all the tests to pass instead of actually fixing code. So I'm not sure I trust it just because tests pass. I also think that tests do not and cannot check everything.

I also don't trust it just because it compiles in Rust. The Rust compiler does not check everything.

So at what point do projects like this cross from "untrusted" to "trusted"?

show comments
nickcw

Maybe it would have made more sense for Anthropic to rewrite Claude Code in rust, and cut out the middle man (bun)?

show comments
internet2000

I don't get it. Because they haven't cut a new arbitrary version number, we're denying it got done (in their perspective) and being used in a massive product already?

If you're being pedantic, no it's not "done," but nothing ever is.

show comments
simonw

One metric I thought might be interesting with respect to the Rust rewrite is the number of "unsafe" occurrences in the code.

I was optimistic those would be going down over time but it looks like they've stayed pretty constant: https://news.ycombinator.com/item?id=48966569#48967630

show comments
knighthacker

There's probably a ton of intangible factors to this, but how do you measure the ROI on this?

yearesadpeople

> _"...Canny..."_

What a time to be alive

show comments
jadar

This doesn't answer the question it asks.

mawadev

I'm gonna say it bluntly: I don't care about bun, never cared about bun and think nodejs is sufficient. The drama surrounding zig and rust still leaves me with a bad taste because I also don't like how nonsensical topics like that influence what we do and what we (have to) care about on a day to day basis. That is just my opinion!

show comments
amazingamazing

Why did they buy an open source project anyway? If is not “officially” supported why not fork and use? Claude code is probably the most used anyway

show comments
vortegne

I didn't follow the thing too closely when it happened. Sure, I was aware of the big picture. But wow, I didn't expect that after all this noise there still hasn't been a release? That's just crazy to me.

I shouldn't be surprised though, of course. Giving any credit or slack to a high-valuation LLM company is a silly endeavor.

show comments
7e

The Rust compiler suffers from a number of crash bugs and nondeterminism, and they won't accept AI diagnoses or fixes, so Rust has become an unreliable partner for software development.

If you're going to do serious development with Rust, I suggest forking the compiler. Upstream your fixes to a fork which takes AI contributions, or fork your own. Or keep all of your improvements private, that works just fine.

tomlockwood

Author here: An apology on the graphs, they just count rust files touched in commits, not total commits. So if there were two commits and one touched 3 .rs files and another touched 2, it'd be counted as 5 for the purposes of the graphs. I may fix this later but, yeah.

show comments
luciana1u

the author wrote a whole blog post asking how the bun rewrite is going and the answer from the thread is: nobody knows, including the author

show comments
IshKebab

This doesn't answer the question posed in the title unfortunately. I am none the wiser about how it's going. The author just speculates that the rewrite isn't actually complete.

show comments
qarl2

Coincidentally - I'm trying to get feedback on my own LLM rewrite project - MAME ROM machine code to Idiomatic JavaScript - the ability for an agent to understand blind code is remarkable.

But sadly HN is hiding my post... :(

https://news.ycombinator.com/item?id=49069383

EDIT: I'd love to hear why I'm downvoted.

show comments
greenlimetea

Rust devs are so obsessed with writing things in Rust that Rust was re-written in Rust.

show comments
brap

If you’ve ever worked at a tech company you already know the answer without reading any further

show comments
Xenoamorphous

> we’re approaching $800k in money spent on this rewrite.

That’s peanuts, if not the shells of the peanuts, for a project and company of this magnitude

show comments