> +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.
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.
Rewrite Bun in Rust has been merged
391–400 of 822 posts
Re: Rewrite Bun in Rust has been merged
#392Re: Rewrite Bun in Rust has been merged
#393Earlier quoted context omitted.
You're not alone in voicing this, another (now dead) comment did it earlier too with a bit more of an emotional response ( https://news.ycombinator.com/item?id=48134229 ). Still, do you folks never do something to see how you feel about something, then chose to go one way or another? I'm not sure why it's so hard to see that it was an overreaction at the time, because it was an experiment, then at one point it stoppe…
Yes sure it's ok to change your mind. But don't you think the people Jarred accused of "overreacting" in retrospect didn't?
That people were overreacting with emotional meltdowns (common in AI-related threads) is perfectly compatible with the branch making enough progress to get merged.
Re: Rewrite Bun in Rust has been merged
#394Earlier 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…
In this case it means you delegated the responsibility to a notably flaky heuristic.
Re: Rewrite Bun in Rust has been merged
#395Re: Rewrite Bun in Rust has been merged
#396Re: Rewrite Bun in Rust has been merged
#397> +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.
EDIT: I misread, sorry! You said "JavaScript interpreter wrapper", which is correct.
Re: Rewrite Bun in Rust has been merged
#398Earlier quoted context omitted.
I can hope this will lead to little to no memory issues in using bun as a web server
I'd be surprised if they could eliminate memory issues completely, especially considering the amount of `unsafe` the codebase seems to contain. git rev-parse HEAD && ag "unsafe" src | wc -l 19d8ade2c6c1f0eeae50bd9d7f2a4bf4a2551557 14865
Re: Rewrite Bun in Rust has been merged
#399Earlier quoted context omitted.
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
#400$ 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?