Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[performance] Redundant source-map encoding roundtrip #2061

Closed
mourner opened this issue Mar 15, 2018 · 2 comments
Closed

[performance] Redundant source-map encoding roundtrip #2061

mourner opened this issue Mar 15, 2018 · 2 comments

Comments

@mourner
Copy link
Contributor

mourner commented Mar 15, 2018

Noticed this huge low hanging fruit while profiling source maps:

src/node-entry.ts → dist/rollup.js, dist/rollup.es.js...

magic-string: chunk: 65.457ms
magic-string: encode: 144.542ms
rollup: decode: 27.857ms
rollup: collapse: 109.229ms

magic-string: chunk: 41.675ms
magic-string: encode: 36.950ms
rollup: decode: 38.783ms
rollup: collapse: 255.896ms

created dist/rollup.js, dist/rollup.es.js in 4.3s

src/browser-entry.ts → dist/rollup.browser.js...

magic-string: chunk: 50.308ms
magic-string: encode: 216.066ms
rollup: decode: 32.689ms
rollup: collapse: 68.621ms

rollup: created dist/rollup.browser.js in 2.6s

When magic-string generates source maps for Rollup, it encodes the mappings array into a spec-compliant string, but then rollup immediately decodes it for further manipulation (collapsing stage). If we introduce a non-encoded version of MagicString generateMap, we can eliminate the steps in bold above entirely, cutting the source map step almost in half.

Stand by while I'm working on corresponding PRs.

@mourner
Copy link
Contributor Author

mourner commented Mar 15, 2018

Upstream PR here Rich-Harris/magic-string#134
Once released, will submit a Rollup PR (already have it working locally).

@marvinhagemeister
Copy link

@mourner Nothing to add, just want you to know that I love your recent PRs 🍀 Thanks for making rollup faster for all of us 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants