- Rolldown's wasm build just got significantly faster in browsers thanks to @broooooklyn.bsky.social! One challenge of native bundlers is that they have to ship and run as wasm in browser environments. Some bundlers like rspack doesn't even support this due to the complexity it involves.
- Moreover - the biggest perf advantage of native bundlers comes from parallelization, but in browsers we'd have to simulate threads using web workers. Without proper optimization, native bundlers can end up being slower than JS bundlers in browsers!
- For example, I was surprised to find out that esbuild's wasm build is actually significantly slower than Rollup in web containers. This may have to do with Go wasm compilation and de-optimized parallelization.
- Rolldown suffered from this too, and we've been wanting to tackle this because we want it to run fast in every use case. Yesterday at the team offsite in Shanghai, our friend @Brooooook_lyn finally solved this by implementing proper worker thread pooling / reuse in napi-rs.
- As a result, Rolldown is now the fastest possible bundler you can run in the browser. Here are the numbers when bundling a benchmark app with 2.5k modules: - esbuild: 22.19s - Vite (via Rollup): 4.52s - Rolldown: ⚡️613.43 ms Try it out yourself on StackBlitz: stackblitz.com/~/github.com...
- The reason why I am very excited about this is because this means every framework building on top of Vite will have blazing fast DX in browser environments - on StackBlitz, via bolt.new, etc.!Dec 19, 2024 05:15