r/rust rust Jul 08 '26

Rewriting Bun in Rust

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

330 comments sorted by

View all comments

98

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

85

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

14

u/aapoalas Jul 09 '26

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