8 ms·
according to the article, Turbopack is 10-20x faster than Vite. I wonder how they were able to edge it out so significantly!
by hmillison 4y ago
according to the article, Turbopack is 10-20x faster than Vite. I wonder how they were able to edge it out so significantly!
- minimaxir 4y agoRust is a hell of a drug.
- maxfurman 4y agoMy guess is some combination of dropping support for older browsers, supporting fewer features, and optimizing for the common case at the expense of edge cases. In a few releases, once all those are added back in, it will be no faster than Vite.
- brundolf 4y agoI would guess they're factoring this in: > Turbopack is built on Turbo: an open-source, incremental memoization framework for Rust. Turbo can cache the result of any function in the program. When the program is run again, functions won't re-run unless their inputs have changed. This granular architecture enables your program to skip large amounts of work, at the level of the function. Which would make that multiple an extremely rough estimate, highly-dependent on the situation. But it's still an exciting development
- IshKebab 4y agoI wonder how they make that robust, given that Rust isn't pure and there's no way to force a function to be pure either.
- brundolf 4y agoIt's not very hard to stick to a pure-ish style even in languages that don't statically enforce it; JavaScript's MobX framework has the same constraint, as do React functions, and computed properties in Vue, etc. You don't really get any static help with functional purity in those cases, but thousands of programmers do it successfully every day And while Rust doesn't strictly enforce purity, it does make it a lot easier to stick to in practice with its explicit `mut` keyword for local variables, references, and function arguments (including for the `self` argument on methods). There are various ways like RefCell to get around this if you're really trying to, but you have to go out of your way.
- fabian2k 4y agoThe answer seems to be caching (https://turbo.build/pack/docs/core-concepts https://turbo.build/pack/docs/core-concepts), lots and lots of caching. Which enables it to reuse a lot of already computed stuff for incremental rebuilds.
- lelandfe 4y agoWhich makes me wonder if the speed comparison graphics are solely about repeat builds.
- hardwaregeek 4y agoIncremental compilation plus not having each dependency be its own network request (I work on Turbo, but not Turbopack).
- atfzl 4y agoVite uses esbuild for transpiling and rollup for bundling. esbuild (written in go) is already pretty fast for transpiling but there might be a lot of possibilities to optimize in rollup as rollup is written in JavaScript.
- FractalHQ 4y agoCoincidentally, the primary maintainer of Rollup mentioned plans for a rust rewrite in his recent talk at Vite Conf.