Wow that’s a huge PR! GitHub comments (just GitHub in general I guess) are really struggling to load right now, but judging from the tags here it seems the rewrite is heavily AI-assisted? Perhaps...
Wow that’s a huge PR! GitHub comments (just GitHub in general I guess) are really struggling to load right now, but judging from the tags here it seems the rewrite is heavily AI-assisted? Perhaps entirely done by AI agents?
This is not wrong, but I do want to be clear that a huge reason this was so successful is because of a very well written and detailed test suite. AI works wonderfully when it can determine its...
This is not wrong, but I do want to be clear that a huge reason this was so successful is because of a very well written and detailed test suite. AI works wonderfully when it can determine its wrong, and it can't flub the test.
It's fun going through my company's codebase and seeing tests that amount to: int var1 = some_default_value; int var2 = some_default_value; assertEquals(var1, var2); Glad we use up valuable CI...
It's fun going through my company's codebase and seeing tests that amount to:
int var1 = some_default_value;
int var2 = some_default_value;
assertEquals(var1, var2);
Glad we use up valuable CI resources for these tests.
The test I'm seeing it write for my projects aren't all that rigorous but I haven't seen it write complete crap either. I think it's okay but you have to keep an eye on it. Back when I was working...
The test I'm seeing it write for my projects aren't all that rigorous but I haven't seen it write complete crap either. I think it's okay but you have to keep an eye on it.
Back when I was working I would see tests that don't actually do anything written by people, too. Usually due to heavy use of mocks.
Ah yeah I wasn't clear on that but yes, an extensive HUMAN WRITTEN test suite was why this was "easy". AI works well in the cases where the known output is already confirmed and testable. If you...
Ah yeah I wasn't clear on that but yes, an extensive HUMAN WRITTEN test suite was why this was "easy". AI works well in the cases where the known output is already confirmed and testable. If you said "build an app like bun in rust and make tests" you'll get a disaster.
Not just Claude, but most likely Claude Mythos. Bun was bought by anthropic because it's used for Claude code, so they almost certainly have free access to Mythos.
Not just Claude, but most likely Claude Mythos. Bun was bought by anthropic because it's used for Claude code, so they almost certainly have free access to Mythos.
Man what a waste of electricity. Now there's a PR filled with so much crap nobody can review it, which means bugs will absolutely be introduced. For what?
Man what a waste of electricity. Now there's a PR filled with so much crap nobody can review it, which means bugs will absolutely be introduced. For what?
They're doing the rewrite because they frequently have bugs caused by memory safety issues, which Zig, like C and C++, does not have good protections against. It's true that this rewrite has a lot...
They're doing the rewrite because they frequently have bugs caused by memory safety issues, which Zig, like C and C++, does not have good protections against. It's true that this rewrite has a lot more usages of unsafe blocks than most Rust projects, but it's a huge improvement from all the code effectively being inside an unsafe block as before, they're manually cutting down on many unnecessary unsafe blocks, and any new code that's written as idiomatic Rust from the start should be free of new memory safety issues.
It's a file-for-file conversion. The new codebase will be very similar in structure and control flow to the old codebase. It's likely not very idiomatic Rust, but it's not as if they vibe coded a...
It's a file-for-file conversion. The new codebase will be very similar in structure and control flow to the old codebase. It's likely not very idiomatic Rust, but it's not as if they vibe coded a million lines without any review. It should be familiar for any existing contributors.
They also have a very clear picture now of where the unsafe keyword is used, and can target those areas for improvement. Rust offers a lot of assurances that Zig did not. There's likely some edge cases still to shake out, but I expect it's no buggier than the code that came before.
You make some good points. Definitely using Rust was a good call. But I have to add, it will definitely be buggier, less idiomatic, less elegant and more bloated than before. That's just where LLM...
You make some good points. Definitely using Rust was a good call. But I have to add, it will definitely be buggier, less idiomatic, less elegant and more bloated than before. That's just where LLM coding agent technology is right now. It's not as if being under the Anthropic umbrella gives them magical powers to make agents perform better. Look at how buggy, verbose and convoluted Claude Code is. It would be different if it was human led with AI assistance rather than just letting the agents churn... but it doesn't sound like that's how they did it given the short timeframe.
Caveat: if they used Mythos and it's lightyears ahead of Opus, maybe it's better than I'm imagining. I'd say that's somewhat unlikely.
Whatever the case, Claude Code and Codex, despite their issues, have proven that you can ship messy, vibe coded software and people will use it. Vibecoded doesn't mean the new Bun won't be successful.
It doesn't load on my end - but like, what's the point of this rewrite? Is Bun so slow that Rust was needed here? Did it provide a measurable performance improvement? I had the impression that Bun...
It doesn't load on my end - but like, what's the point of this rewrite?
Is Bun so slow that Rust was needed here? Did it provide a measurable performance improvement? I had the impression that Bun is the faster of the JS tools.
I am genuinely in love with Rust, so the more big projects in it the better, but I'm also a practical person, and rewrites are not always the best idea, unless the architecture was flawed or the stack was just so awful.
Memory safety. Rust has stronger rules for this, and the lead dev straight up cited tons of time dealing with segfaults as the reason for the jump. There are other arguments that it's because...
It doesn't load on my end - but like, what's the point of this rewrite?
Memory safety. Rust has stronger rules for this, and the lead dev straight up cited tons of time dealing with segfaults as the reason for the jump.
There are other arguments that it's because since anthropic acquired bun and Zig is heavily anti AI anything in their code base that this was another reason because they couldn't contribute to Zig development, but i haven't looked into that side so grain of salt. I have no idea how much of that is true or not.
Edit:
Last comment I read from them on HN:
Still writing the blog post about this. Will share more details.
For where this is coming from, skim the bugfixes in the Bun v1.3.14 and earlier release notes. Rust won’t catch all of these - leaks from holding references too long and anything that re-enters across the JS boundary are still on us. But a large % of that list is use-after-free, double-free, and forgot-to-free-on-error-path, which become compile errors or automatic cleanup.
Ah, okay, in retrospect that makes sense for a JS runtime. If Zig & C++ cause that much trouble for them then it's a worthwhile effort. That said I do believe they could have done an incremental...
Ah, okay, in retrospect that makes sense for a JS runtime. If Zig & C++ cause that much trouble for them then it's a worthwhile effort.
That said I do believe they could have done an incremental rewrite instead of just converting it all at once, but if the test suite is as robust as they claim (haven't checked it myself) then maybe it is fine, alongside a proper beta test phase.
The original take was “fuck it why not” with the expectation they’d probably throw it out. It apparently performed better than they expected hence the full rewrite
The original take was “fuck it why not” with the expectation they’d probably throw it out.
It apparently performed better than they expected hence the full rewrite
Effectively Bun is now 'open source' in name only since no sane human being will review or work on a million lines of AI generated code. The whole project can now only be worked on with LLMs. In...
Effectively Bun is now 'open source' in name only since no sane human being will review or work on a million lines of AI generated code. The whole project can now only be worked on with LLMs.
In some sense it's the open source version of "Flood the zone with shit".
I think it's hard to say at this point how this will pan out. Here's the current output of cloc on the repo: ---------------------------------------------------------------------------------------...
I think it's hard to say at this point how this will pan out. Here's the current output of cloc on the repo:
The AI-written rust has way more comments (not surprising, AI loves to write comments). I could see the increase in LoC from the zig and rust versions as due to inherent verboseness of rust code. You're tracking more things using language features, so you need a few more LoC to do the same work.
The most worrying number is the increased file count. Rust has 11% more files than zig. I suppose that means (very hand-wavey) it's 11% more complicated in architecture see below.
Edit: So says my LLM, the extra LoC mostly come from rust RAII and trait boilerplate. The code seems to be a pretty clean 1:1 port so I expect people familiar with the original code architecture could easily get up to speed with the new code.
Edit 2: The extra rust files are mainly lib.rs, mod.rs and build.rs files. The rust code also puts FFI boilerplate into separate files while zig does not.
Thanks for the info! I just think if I had worked diligently on efficient Zig code for this project as a contributor before, I'd feel completely deflated after this move. Jarred Sumner allegedly...
Thanks for the info!
I just think if I had worked diligently on efficient Zig code for this project as a contributor before, I'd feel completely deflated after this move. Jarred Sumner allegedly llm'd all this in a few days, and if I had been a (non-AI) contributor to this project, I'd be absolutely demotivated to work on this now.
Also this can't be good Rust code, right? A 1:1 port from Zig has to have thousands of unsafe sections, circumventing the borrow checker and Rusts philosophy. I can't imagine that Rust devs would want to work on a project like this.
But yeah, it's going to be interesting to see how it pans out.
Supposedly the port has already fixed a few memory safety bugs. Look for yourself if you want to see how the code looks. If you were a contributor I think you’d find your old code in there just...
Supposedly the port has already fixed a few memory safety bugs. Look for yourself if you want to see how the code looks. If you were a contributor I think you’d find your old code in there just with a different coat of paint.
Wow that’s a huge PR! GitHub comments (just GitHub in general I guess) are really struggling to load right now, but judging from the tags here it seems the rewrite is heavily AI-assisted? Perhaps entirely done by AI agents?
Not assisted, done entirely by Anthropic's Claude.
This is not wrong, but I do want to be clear that a huge reason this was so successful is because of a very well written and detailed test suite. AI works wonderfully when it can determine its wrong, and it can't flub the test.
Notably:
Don’t let Claude write the tests itself. It likes to pretend to write tests but then just build trivial tests
It's fun going through my company's codebase and seeing tests that amount to:
Glad we use up valuable CI resources for these tests.
Some people turn on the AI and turn off their brain.
The test I'm seeing it write for my projects aren't all that rigorous but I haven't seen it write complete crap either. I think it's okay but you have to keep an eye on it.
Back when I was working I would see tests that don't actually do anything written by people, too. Usually due to heavy use of mocks.
Ah yeah I wasn't clear on that but yes, an extensive HUMAN WRITTEN test suite was why this was "easy". AI works well in the cases where the known output is already confirmed and testable. If you said "build an app like bun in rust and make tests" you'll get a disaster.
Not just Claude, but most likely Claude Mythos. Bun was bought by anthropic because it's used for Claude code, so they almost certainly have free access to Mythos.
Man what a waste of electricity. Now there's a PR filled with so much crap nobody can review it, which means bugs will absolutely be introduced. For what?
They're doing the rewrite because they frequently have bugs caused by memory safety issues, which Zig, like C and C++, does not have good protections against. It's true that this rewrite has a lot more usages of unsafe blocks than most Rust projects, but it's a huge improvement from all the code effectively being inside an unsafe block as before, they're manually cutting down on many unnecessary unsafe blocks, and any new code that's written as idiomatic Rust from the start should be free of new memory safety issues.
They're swapping memory bugs for slop bugs.
It's a file-for-file conversion. The new codebase will be very similar in structure and control flow to the old codebase. It's likely not very idiomatic Rust, but it's not as if they vibe coded a million lines without any review. It should be familiar for any existing contributors.
They also have a very clear picture now of where the
unsafekeyword is used, and can target those areas for improvement. Rust offers a lot of assurances that Zig did not. There's likely some edge cases still to shake out, but I expect it's no buggier than the code that came before.You make some good points. Definitely using Rust was a good call. But I have to add, it will definitely be buggier, less idiomatic, less elegant and more bloated than before. That's just where LLM coding agent technology is right now. It's not as if being under the Anthropic umbrella gives them magical powers to make agents perform better. Look at how buggy, verbose and convoluted Claude Code is. It would be different if it was human led with AI assistance rather than just letting the agents churn... but it doesn't sound like that's how they did it given the short timeframe.
Caveat: if they used Mythos and it's lightyears ahead of Opus, maybe it's better than I'm imagining. I'd say that's somewhat unlikely.
Whatever the case, Claude Code and Codex, despite their issues, have proven that you can ship messy, vibe coded software and people will use it. Vibecoded doesn't mean the new Bun won't be successful.
It doesn't load on my end - but like, what's the point of this rewrite?
Is Bun so slow that Rust was needed here? Did it provide a measurable performance improvement? I had the impression that Bun is the faster of the JS tools.
I am genuinely in love with Rust, so the more big projects in it the better, but I'm also a practical person, and rewrites are not always the best idea, unless the architecture was flawed or the stack was just so awful.
Memory safety. Rust has stronger rules for this, and the lead dev straight up cited tons of time dealing with segfaults as the reason for the jump.
There are other arguments that it's because since anthropic acquired bun and Zig is heavily anti AI anything in their code base that this was another reason because they couldn't contribute to Zig development, but i haven't looked into that side so grain of salt. I have no idea how much of that is true or not.
Edit:
Last comment I read from them on HN:
Ah, okay, in retrospect that makes sense for a JS runtime. If Zig & C++ cause that much trouble for them then it's a worthwhile effort.
That said I do believe they could have done an incremental rewrite instead of just converting it all at once, but if the test suite is as robust as they claim (haven't checked it myself) then maybe it is fine, alongside a proper beta test phase.
The original take was “fuck it why not” with the expectation they’d probably throw it out.
It apparently performed better than they expected hence the full rewrite
Effectively Bun is now 'open source' in name only since no sane human being will review or work on a million lines of AI generated code. The whole project can now only be worked on with LLMs.
In some sense it's the open source version of "Flood the zone with shit".
I think it's hard to say at this point how this will pan out. Here's the current output of
clocon the repo:The AI-written rust has way more comments (not surprising, AI loves to write comments). I could see the increase in LoC from the zig and rust versions as due to inherent verboseness of rust code. You're tracking more things using language features, so you need a few more LoC to do the same work.
The most worrying number is the increased file count. Rust has 11% more files than zig. I suppose that means (very hand-wavey)
it's 11% more complicated in architecturesee below.Edit: So says my LLM, the extra LoC mostly come from rust RAII and trait boilerplate. The code seems to be a pretty clean 1:1 port so I expect people familiar with the original code architecture could easily get up to speed with the new code.
Edit 2: The extra rust files are mainly
lib.rs,mod.rsandbuild.rsfiles. The rust code also puts FFI boilerplate into separate files while zig does not.Thanks for the info!
I just think if I had worked diligently on efficient Zig code for this project as a contributor before, I'd feel completely deflated after this move. Jarred Sumner allegedly llm'd all this in a few days, and if I had been a (non-AI) contributor to this project, I'd be absolutely demotivated to work on this now.
Also this can't be good Rust code, right? A 1:1 port from Zig has to have thousands of unsafe sections, circumventing the borrow checker and Rusts philosophy. I can't imagine that Rust devs would want to work on a project like this.
But yeah, it's going to be interesting to see how it pans out.
Supposedly the port has already fixed a few memory safety bugs. Look for yourself if you want to see how the code looks. If you were a contributor I think you’d find your old code in there just with a different coat of paint.