Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Rewriting Bun in Rust (bun.com)
91 points by afturner 1 hour ago | hide | past | favorite | 18 comments
 help



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


True, but rewrites often allow for this sort of benefit in themselves. It's possible rewriting it in zig would have yielded some of the same improvements.

I would guess that people looking to use Zig understand that those are project concerns and not language concerns.

The stability gains are a direct language concern as mentioned throughout the article.

From a PL Theory perspective, Zig is vibe-coded.

Not sure why people use it.


Where is the cost breakdown? I feel like this would be the easiest number to determine and write in this post. It's hard to believe that there have been no problems/downsides since the port.

> Where is the cost breakdown?

From the article

> 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

> It's hard to believe that there have been no problems/downsides since the port.

A significant portion of the article was dedicated to the 19 regressions they've found. Starting here: https://bun.com/blog/bun-in-rust#porting-mistakes


One thing that I found interesting is that most of the discourse surrounding the topic happened with the assumption that the rewrite was happening with an Opus-like model, and not with Fable. Those assumptions, at least partially, were used as arguments against the fact that the rewrite was feasible and/or a good idea.

Clearly the model itself doesn't completely change the narrative, but at least as a note to myself, I would like to be more careful with assuming the capabilities of the models used internally by Anthropic and affiliated orgs.


> Claude Code v2.1.181 (released June 17th) and later use the Rust port of Bun.

It seems the reports of Bun's death have been greatly exaggerated.


This slop rewrite introduced new vulnerabilities and regressions.

Adding bespoke animations via Claude Code to the blog post is definitely thematic. It's unclear if they're useful data visualizations as they take a bit of time to parse, but they're neat.

You can see the size difference in the number of files https://app.principal-ade.com/oven-sh/bun

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.ycombinator.com/item?id=48240829


EDIT: the parent has effectively deleted their original comment

> There are a lot of ways to do a terrible job of this. For example, prompting Claude "Rewrite Bun in Rust. Don't make any mistakes." and then praying it would work is not what I did.


*whoosh* goes the joke.

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.


It's ok to admit that you did not get the joke. That's fine.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: