Live data from Hacker News

Bun's unreleased Rust port has 13,365 unsafe blocks

bun.com

51–57 of 57 posts

Re: Bun's unreleased Rust port has 13,365 unsafe blocks

#53
post #18
post #10

Bun is(was?) a lot about performance. How does it compare to zig?

Rust and Zig both use the same optimizing compiler (LLVM) so assuming the vibe coded port didn't introduce performance pitfalls and kept the algorithms the same, the end result should be in the single digit performance difference with the original.

I believe in the latest (possibly two latest?) releases of Zig you have the option to build a self hosted compiler.

Re: Bun's unreleased Rust port has 13,365 unsafe blocks

#54
post #18

Earlier quoted context omitted.

Rust and Zig both use the same optimizing compiler (LLVM) so assuming the vibe coded port didn't introduce performance pitfalls and kept the algorithms the same, the end result should be in the single digit performance difference with the original.

I believe in the latest (possibly two latest?) releases of Zig you have the option to build a self hosted compiler.

That may ne useful for bootstrapping but there's no way a self-made compiler can be competitive with LLVM. Optimizing compilers are crazy beasts.

Re: Bun's unreleased Rust port has 13,365 unsafe blocks

#56
post #21
post #7

The current level of insanity with AI is off the charts. Porting to a safe language without the safety features.

As a human I would likely port it the same way. First a translation close to 1:1 from the source, then redesign/refactor areas little by little to match the target language idioms

So don't port. Write a better version.

Re: Bun's unreleased Rust port has 13,365 unsafe blocks

#57

13k unsafe blocks is a reminder that unsafe on its own isn’t the problem, it’s whether that unsafe boundary is small and audited. The number that matters more is how much of the codebase depends on unchecked invariants. If the answer is most of it, the port is moving too fast.

Of course it's moving too fast. Its unaudited and noone will ever audit it and also nobody wants this.
Post reply on HN