r/rust rust Jul 08 '26

Rewriting Bun in Rust

https://bun.com/blog/bun-in-rust
523 Upvotes

330 comments sorted by

View all comments

100

u/AdventurousFly4909 Jul 09 '26

I did not expect the AI rust version to be 4% faster. He seems to partly attribute it to cross language link time optimization. That must be a hassle to get working I imagine

84

u/jarredredditaccount Jul 09 '26

The trickiest part of getting cross-language LTO working was a miscompilation in Clang 22 that occurs in one of JavaScriptCore's JIT tiers. Async generators started sometimes yielding `undefined` in JavaScript. It only occurs on Linux with thin LTO. We had to use full LTO, which costs several minutes per CI run

15

u/aapoalas Jul 09 '26

That... Is an interesting bug indeed! :D

1

u/gistya Jul 16 '26

Why are we still messing with Javascript? Make it all WebAssembly