Live data from Hacker News

Rewriting Bun in Rust

bun.com

41–50 of 560 posts

Re: Rewriting Bun in Rust

#41
post #11

Earlier quoted context omitted.

Hacker News does not have a meme-y culture, and this post takes this topic pretty seriously and is technically interesting. It's not so much that I missed that it was a joke, I just don't think that it really added to the discussion. What you've edited it to is a much better comment.

[flagged]

Jokes require mutual context. You failed to create a joke because you did not ensure the prerequisites were met.

Re: Rewriting Bun in Rust

#42
post #40

This blog post further undermines my trust in Jarred. He makes it sound like Claude did a fantastic Rust rewrite, and "the work continues." But when the Rust port merged to main, the state of the code was very, very bad. There were 13,000 instances of `unsafe`, no Miri tests at all, and, sure enough, it exposed UB in safe Rust. https://github.com/oven-sh/bun/issues/30719 Observers could see this coming from a mile aw…

> We haven’t committed to rewriting. There’s a very high chance all this code gets thrown out completely. God forbid an engineer express uncertainty.

Uncertainty is one thing, but a high chance means it’s 51% or higher to me.

Based on that, the bun rewrite messaging was fairly misleading.

Re: Rewriting Bun in Rust

#43

So I kept hearing that the author did this purely because Anthropic wanted a PR story, but reading this entire very well written post, with meticulous detail, what say you now? I never thought it made any sense for him to do this just because Anthropic asked him to. Sometimes you find yourself fighting the stack you're currently using, and another stack (or programming language) looks like it would alleviate a lot. L…

> what say you now?

I think that when you have a $165,000 hammer, all of your problems begin to look a lot like nails.

Re: Rewriting Bun in Rust

#44
post #23
post #5

Without commenting on Bun itself as a project, or the nature of the rewrite, it can't be good for Zig that a naive rewrite away from it fixed memory leaks, improved stability, shrunk binary size by 20%, and improved performance by 5%.

Wouldn't the same improvements have been made in zig if they instructed the agents to improve instead of rewrite?

But how would you verify that the agents have written memory safe code? Rust's borrowchecker is a lot faster and actually verifiably safe compared to asking an LLM to fix the safety issues that the Zig version had.

Re: Rewriting Bun in Rust

#45
post #5

Without commenting on Bun itself as a project, or the nature of the rewrite, it can't be good for Zig that a naive rewrite away from it fixed memory leaks, improved stability, shrunk binary size by 20%, and improved performance by 5%.

Yeah but they turned it into something unreadable. Call it a skill issue if you wish. I just haven’t found another language that just makes sense. Zig doesn’t hide anything from you

>they turned it into something unreadable

Did you compare the code before/after? It's a mechanical line-by-line port, and most of the code is identical to the old version, just with Rust syntax. They have an example in the blog post.

Re: Rewriting Bun in Rust

#46
post #39

Earlier quoted context omitted.

> There's less and less reason to use GC'd languages in the agentic coding era. Faster iteration, maybe? Rust's safety guarantee isn't exactly free (while still being very excellent) and does affect iteration time. I have a private project (>300K LoC) that has been translated from Python to TypeScript and the reason we couldn't use Rust was definitely the iteration time.

Eh... rust's safety isn't free, but not having it and wasting time on "oh I forgot to change this call site" also isn't free. On the whole I'd say the safety assists in iteration time. What costs rust in iteration time in my opinion is the low level (by default) nature of it. There's a faster-to-iterate language that has yet to be created which is rust but we sacrifice performance (and memory fiddling ergonomics for…

Maybe something like Hylo? But personally I don't see anything displacing rust for the next few years, as I think there's enough rust in the training data for it to be the best "serious" language for agentic systems-level development.

It's really the only systems language in its exact niche.

Re: Rewriting Bun in Rust

#47

>Combined with the Rust rewrite, ICU changes, and identical code folding, Bun's binary size shrinks by ~20% on Linux & Windows. People who are surprised by this probably has not seen what Zig code actually looks like. Zig's explicitness and lack of abstraction have a real cost that it is basically one of the most verbose programming languages I've ever seen, it's somehow even more verbose than Go. Basic features of m…

> Ironically, Zig is a programming language that's probably best written by LLMs, since they can tolerate actually tolerate the verbosity. Rust in my opinion feels the same.

That can often depend on how you write it.

Re: Rewriting Bun in Rust

#48
Every time I've rewritten a major project I've made it smaller and faster while fixing all the major bugs and most of the minor ones. My current team has had similar experiences. I'd be curious to see what a Zig -> Zig rewrite of the same magnitude would have done for quality.

Re: Rewriting Bun in Rust

#49
post #4

As expected [0] [1], this was a clear advertisement / marketing opportunity of Anthropic's Fable model on rewriting Bun (which powers Claude Code) from Zig into Rust. Something that would have taken hundreds of developers now took 1 developer with Fable. Now Claude, rewrite Claude Code from TypeScript to Rust. Make absolutely zero mistakes. [0] https://news.ycombinator.com/item?id=48073893 [1] https://news.ycombinato…

1 Developer with a 200k budget for tools.

Re: Rewriting Bun in Rust

#50

So I kept hearing that the author did this purely because Anthropic wanted a PR story, but reading this entire very well written post, with meticulous detail, what say you now? I never thought it made any sense for him to do this just because Anthropic asked him to. Sometimes you find yourself fighting the stack you're currently using, and another stack (or programming language) looks like it would alleviate a lot. L…

> what say you now? I think that when you have a $165,000 hammer, all of your problems begin to look a lot like nails.

I've done rewrites like this, maybe it wasn't Zig to Rust, but I have been able to rewrite sizable projects, from C# to Rust before. I incorporated a similar strategy, have Claude Opus review the codebase, write a spec, then have Claude implement it, while reviewing the spec, and using the codebase as fallback and gospel over the spec. That said, it's not the entire story here as I said, there was a lot of thought put into it, it it had not been done with Claude, I have a feeling he might have started an "experimental" version of Bun in Rust instead, as many developers have done in the past before LLMs.
Post reply on HN