Live data from Hacker News

Rewrite Bun in Rust has been merged

github.com

341–350 of 822 posts

Re: Rewrite Bun in Rust has been merged

#341
post #242

By reading this thread I've learned that, apparently, you are not allowed to rewrite a large piece of software backed by a large test suite in another language within two weeks otherwise you are a witch and need to be burned on a stake. You are also not allowed to move from the PoC phase to lets-do-it phase within a couple of days without being called names. Why are we concerned with speed all of a sudden? Are we in…

The top comment in the thread explains it pretty well, so please don't pretend it's anything else. The point is they went from "chillax, it's just an experiment" to "we'll switch languages via a 1M line vibecoded patch" in two days. People that rely on this software are understandably fearful, since there is no way this change has been properly revised and tested. Although perhaps the mistake was relying on such soft…

Why "no way"? You're also forgetting extensive test suite?

Merging it so quickly only odd if you're planning on retaining current community.

It's not like it was merged and shipped to every single stable distro overnight. That's how things get tested.

Re: Rewrite Bun in Rust has been merged

#342
post #6

I'm actually excited for somebody trying experimenting with automated translation, but I'm afraid this will be lots of backwards compatibility issues. I started looking at the commits, and it's basically solving the ,,tests not pass'' problem by changing the tests themselves. The real work of making it working on programs that are already deployed will be just starting now. The only silver lining I see is that the se…

I wish I could take a look through the tests to see if anything substantial actually changed, but I can't even get github to load the diffs for me.

Re: Rewrite Bun in Rust has been merged

#343

Earlier quoted context omitted.

The Bun codebase had a similar number of lines of code before the rewrite. There's nothing unusual about a rewrite coming in with a similar LOC number.

If anything, it's a little surprising that the Rust code isn't significantly larger because I tend to think of Rust as requiring somewhat more boilerplate than JS.

The code was using Zig before, not JS.

Re: Rewrite Bun in Rust has been merged

#344
post #308
post #249

$ 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…

Cool you can just search specifically for potentially unsafe code in Rust. How do you search for unsafe code in Zig? Or do you just have to assume it's everywhere?

if half of your files in a million line codebase are unsafe that doesn't tell you much any more. Presumably the point of a Rust rewrite is that you actually make use of Rust's safety features in a coherent way.

But 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.

Re: Rewrite Bun in Rust has been merged

#345
post #289

Earlier quoted context omitted.

The half of the files contain 'unsafe' keyword? It doesn't seem as a good rewrite. What is the point of rewrite into Rust, if ~half of your code is still unsafe?

unsafe just means that you take responsibility for the safety of the code contained within. Calling into non-Rust libraries has to be wrapped in unsafe. Making syscalls has to be wrapped in unsafe. Bun needs to interact with FFI code. This gets wrapped in unsafe blocks. There are many places where a JavaScript interpreter and library would need to make unsafe calls and operations. It doesn't literally mean the code i…

> a JavaScript interpreter

Bun is not a Javascript interpreter. But I do see the point.

Re: Rewrite Bun in Rust has been merged

#346
post #322
post #300

Earlier quoted context omitted.

Edit: my mistake. Sorry for misreading. You've crossed into personal attack with this, and that's not allowed here. Please don't. https://news.ycombinator.com/newsguidelines.html

Which persons were attacked by their comment? The "them" is confusing me – I interpreted it as Bun the organisation / Anthropic?

I'm confused too as to how my comment can be interpreted as a personal attack on anyone.

I was indeed talking about Bun as a whole and not any particular person. I'd even include the Bun community in my "them".

But I'll take dang's word for it and will watch what I say.

Re: Rewrite Bun in Rust has been merged

#347

Earlier quoted context omitted.

It seems it was an experiment at that moment, and that it went well? I do hope they release it under 2.x though, cannot imagine how a 1M LoC can break in so many ways, especially if what xiphias says is true: https://news.ycombinator.com/item?id=48132902

If I got magically handed the perfect rust rewrite for a project of this magnitude, it would take way longer than 9 days to merge, because I would need to make sure it's actually good.

> it would take way longer than 9 days to merge, because I would need to make sure it's actually good

What if another (unstated) goal of your rewrite was to provide marketing material for how advanced your acquirers AI tools are? The faster the turnaround, the better they (and therefore you) look.

Re: Rewrite Bun in Rust has been merged

#348

I'm confused. Never heard of Bun until a few days ago here on HN. It's some nodejs wrapper thingy, written in Zig, and someone decided to use LLM to rewrite it in Rust. Is this a big deal? Who is even using this software? Why is this big?

Bun isn't a node.js wrapper. It's an alternative to node.js that sits at roughly the same spot in the stack. 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…

Answering “who is even using this software” is unfortunately missing in your answer. I am honestly curious. I’ve never seen it “in the wild” (in job descriptions, hearing from past colleagues, meetups etc). Only place I heard about it is HN and Twitter.

Re: Rewrite Bun in Rust has been merged

#349

> +1009257 -4024 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.

I'm not sure if it's just the leading '+' or if there are other factors for phone number detection on iOS, but on mobile the line count changes are underlined and I can tap it to start a call, which, if it is because of the diff size, is something I find pretty amusing.

> +1009257 -4024

    +1 (009) 257-4024

I think it just lines up with the typical size of a phone number and the '-' is interpreted as a separator. Just a simple regex probably.

Re: Rewrite Bun in Rust has been merged

#350
post #281

Earlier quoted context omitted.

I think relatively few people are probably running Bun in production, but as a dependency management system and bundler for the JavaScript ecosystem, it's similar to `uv` from the Python ecosystem in how much faster it is compared to the most popular alternatives so it's fairly popular in that space.

PNPM is just as fast and much more reliable.

Agree with this. Been a long time pnpm user that also uses bun nowadays. Not much faster other than initial startup because pnpm uses Node.js

Although pnpm has also been trying to rewrite Rust before, they call it pacquet. It is currently being revisited

Post reply on HN