3 ms·
Rollup produces an AST (with acorn) then it manipulates the original source code as a string with MagicString which is a less than ideal hack for code transform
by unroller 3y ago
Rollup produces an AST (with acorn) then it manipulates the original source code as a string with MagicString which is a less than ideal hack for code transformations. Will Rolldown eschew the MagicString approach altogether and transform the AST directly? The advantage would be that the emitted code would not have to be reparsed again for downstream use.
- steelbrain 3y agoBased on my experience in writing JS tooling (https://github.com/steelbrain/pundle https://github.com/steelbrain/pundle / https://aneesiqbal.ai/2020-05-17-what-i-dont-like-about-node-js/ https://aneesiqbal.ai/2020-05-17-what-i-dont-like-about-node... ), even if rollup stayed in js and continued to use magic string, but somehow gained multi-core capabilities and cheaper memory operations, it may be able to somewhat compete with the rust tooling. JS tooling is mostly single threaded. It is expensive to stringify a large AST and then parse it again over IPC vs just transferring an object (which is not allowed by runtime). This cost incentives more things happening in the same process, so there’s a limit to how fast you can be with JS
- bsimpson 3y agoThere was a moment a few years ago when steelbrain's pundle was the only tool I knew of with proper instant hot module replacement. It went the way that many one-man projects with no community backing so, which made me sad. I moved to Rollup, and then recently moved to Vite to get back on the instant HMR train. Thanks for your work in this space, steelbrain! pundle was awesome!