Rewriting Bun in Rust

3 months ago by SorteKanin to c/rust

tyler 17 points 3 months ago

This Rust rewrite would've taken a team of engineers with full-context on the codebase a year of work

Doubt.

path: 0 24689705, hotness: undefined, score: 17, children: 2
SorteKanin 11 points 3 months ago

I mean it was 600,000 lines of Zig prior to the rewrite yea? If we say that a team is ~6 people, that's 100,000 lines each to read through and translate. Assuming 250 working days in a year, that's 400 lines of code you just need to read every day, let alone the Rust you need to be writing (approximately another 400 lines).

Add to that overhead for planning and coordination... I actually think a year for a team might be an underestimate.

path: 0 24689705 24693689, hotness: undefined, score: 11, children: 1
TehPers 7 points 3 months ago

Zig's features don't map 1:1 to Rust's features, so translating line-by-line (or file-by-file) doesn't even make much sense. What are you supposed to do with a crazy comptime function full of reflection when translating that? What about custom pointer types (which Bun had to create for Rust), lifetimes, differences in ecosystem library APIs, etc?

The author actually mentions the challenges they ran into due to breaking the code up across multiple crates. They needed to break cyclic dependencies for it all to compile.

I agree. 1 year is an underestimate.

path: 0 24689705 24693689 24695567, hotness: undefined, score: 7, children: 0
seadoo 14 points 3 months ago

https://andrewkelley.me/...

Commentary/blog post by Andrew Kelley (Zig creator) for perspective!

Very interesting achievement, and of course requires domain knowledge to implement (which you can’t get without experience!)

path: 0 24697449, hotness: undefined, score: 14, children: 1
trevor 9 points 3 months ago

This should definitely be required follow-up reading, as it puts many of the Bun article's "too good to be true" claims into context.

The fact that the Bun author didn't know that Zig also has LTO really puts the rest of their claims into question.

path: 0 24697449 24699775, hotness: undefined, score: 9, children: 0
Melusine 8 points 3 months ago

Honestly, if this is tge future for software engineers,, I'll leave the fields when I ma forced to do it.

path: 0 24693784, hotness: undefined, score: 8, children: 0
rust
rust

@programming.dev

login for more options
8322
1422
379

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits
  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

go to feed...