▲ 23 ▼ Rewriting Bun in Rust (bun.com) submitted 2 months ago by SorteKanin@feddit.dk to c/rust@programming.dev 11 comments fedilink hide all child comments
[–] tyler@programming.dev 16 points 2 months ago (2 children) This Rust rewrite would've taken a team of engineers with full-context on the codebase a year of work Doubt. permalink fedilink source hideshow 4 child comments replies: [–] SorteKanin@feddit.dk [S] 11 points 2 months ago (1 child) 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. permalink fedilink source parent hideshow 2 child comments replies: [–] TehPers@beehaw.org 7 points 2 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. permalink fedilink source parent [–] pinguinu@lemmygrad.ml 8 points 2 months ago Maybe, but it wouldn't have 17000 unsafe clauses 😸 permalink fedilink source parent
[–] SorteKanin@feddit.dk [S] 11 points 2 months ago (1 child) 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. permalink fedilink source parent hideshow 2 child comments replies: [–] TehPers@beehaw.org 7 points 2 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. permalink fedilink source parent
[–] TehPers@beehaw.org 7 points 2 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. permalink fedilink source parent
[–] pinguinu@lemmygrad.ml 8 points 2 months ago Maybe, but it wouldn't have 17000 unsafe clauses 😸 permalink fedilink source parent