Hacker News new | past | comments | ask | show | jobs | submit login

according to the article, Turbopack is 10-20x faster than Vite. I wonder how they were able to edge it out so significantly!



I 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


I 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.


It'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.


The answer seems to be caching (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.


Which makes me wonder if the speed comparison graphics are solely about repeat builds.


Vite 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.


Coincidentally, the primary maintainer of Rollup mentioned plans for a rust rewrite in his recent talk at Vite Conf.


Incremental compilation plus not having each dependency be its own network request (I work on Turbo, but not Turbopack).


Rust is a hell of a drug.


My 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: