Bun is now over 1M lines of Rust code.
This is approaching the size of the Rust compiler itself; except that BunJs is mostly a JavaScript interpreter wrapper + a reimplementation of the NodeJS library (Rust STD wrapper).
I think BunJS is becoming the canary for software complexity management in the LLM era.
There's nothing unusual about a rewrite coming in with a similar LOC count.
Yeah, Cursor did the same thing, bragging about how many lines of code they managed to produce for a semi-working browser, completely missing the idea where less code is better, not the other way around.
Even if it's mostly accidental, and the code is overengineered slop (which it is), the system being able to decompose a problem and deliver something is impressive in terms of stability: it wasn't sucked into rewriting everything from scratch every time it would run into issues, it didn't have infinite subagent recursion with a one-agent-per-line type workflow, etc.
$ rg 'unsafe [{]' src/ | wc -l
10428
$ rg 'unsafe [{]' src/ -l | wc -l
736
Language Files Lines Code Comments Blanks
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Rust 1443 929213 732281 116293 80639
Zig 1298 711112 574563 59118 77431
TypeScript 2604 654684 510464 82254 61966
JavaScript 4370 364928 293211 36108 35609
C 111 305123 205875 79077 20171
C++ 586 262475 217111 19004 26360
C Header 779 100979 57715 29459 13805But given the whole "let AI rewrite this for me" stunt nature of this project that was not going to happen because that would require well, actual thinking and a re-design. So now you have Zig disguised as Rust and a line-by-line port because the semantics of idiomatic Rust don't map on the semantics of Zig.
It also looks like the top 2 maintainers are currently actively working on getting the amount of unsafe down and it's going down quickly.
2. Turn into idiomatic rust.
I think the goal was to do a massive rewrite for Anthropic (they acquired bun) and show that rewriting projects from lang -> lang with Claude can reduce security vulnerabilities to help with the hype for an IPO.
I don’t use/know Rust so I can’t comment on the quality, but there was a public security review that found issues with the new Rust code: https://x.com/SwivalAgent/status/2054468328119279923
This is an interesting experiment but I’m skeptical of any claims of success by Jarred/Anthropic due to the incentive to hype agents by Anthropic. I’d like to see the same on a project without so much relying on the story being success.
Anthropic seems to be developing this part of their business with Mythos and the super review features
At home:
> 10428
It was uncertain then, and not so uncertain now.
I would say it is reasonably clear they had already committed to rewriting at that point.
The possibility that that particular code might be thrown out was potentially true, but also totally unrelated to the previous statement.
At the end of the day, whatever, but this feels a heck of a lot like “ah, we didn't mean for this to be public yet” rather than “this is just a random experiment”.
AI companies love AI stories.
It is an AI company.
:p
Node.js is a distribution of the V8 JavaScript engine (the thing that executes JavaScript in the Chrome browser), along with a bunch of standard library code written mostly in C++.
Bun is a distribution of the JavaScriptCore engine (the thing that executes JavaScript in the Safari browser), along with a bunch of standard library code written mostly in Zig (and now Rust). Bun's standard library is in many cases compatible with or inspired by the Node.js standard library, but with some changes for convenience and performance.
Also at some point Bun was acquired by Anthropic. And some people feared that this will greatly influence Bun's development.
https://news.ycombinator.com/item?id=48073680
Didn't age well, did it?
Does anyone know how exactly Bun is used by Anthropic? Is it a part of Claude Code? I'm more than slightly worried about using Bun going forward myself, but I'm not sure to what extent that applies to using Claude as well.
You definitely cannot!
If you can't trust your test suite to catch an automatic language translation you shouldn't trust it at all. :)
It seems to be used by anthropic as a way to shift the discussion window into it being acceptable that you yolomerge millions of lines.
I had to literally force quit my browser because of how much it lagged iirc.
See jared comment [0]
If this helps bun and rust is a better lang for developing bun going forward with the help of claude. Then i think that is just find.
I thought rust was making the codebase complex so zig won on speed and dx.
But with llm and a large codebase it seems like rust gives fewer bug and you can develop it faster & safer.
https://news.ycombinator.com/reply?id=48133519&goto=threads%...
That said, I'm still shocked and amazed that something this big is possible these days. But as we've seen multiple times now, one of the most important things your codebase can have is a solid test suite.
I will continue to use bun, because at the end of the day, it isn't just the technology, but the talent/people behind the technology that ensures that it will be solid.
And since that hasn't changed, I will still trust bun and its direction.
Also, bun is mostly glue code and sort of "user space" libraries (my words) as Jarred has said on X, most of the underlying runtimes like JavascriptCore, etc weren't rewritten.
So this isn't like 100% of what we think of as bun was rewritten. It's more like the scaffolding and harness.
Writing software with an LLM is doing it carelessly.
Fair call on the same C abi. Adapting to node 26.1.0's new FFI is happening in https://github.com/anomalyco/opentui/pull/104 . There's also some new FFI adapters opentui is adding there, and they're adding a worker.
So there is some adaption. That was sort of the interesting useful actual look I thought might be informative, where-as I feel like you were mostly just trying to be curt & maintain a status quo of keeping us all uninformed/unknowing. Let's try actually providing useful steps forwards when we post, ok?
It's hard for me to see this not becoming a pile of slop, but hey, maybe I'm wrong