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

perf: delay guess encoded #216

Merged
merged 4 commits into from Jun 5, 2022

Conversation

sapphi-red
Copy link
Contributor

This PR includes changes from #215

Potentially breaking change
I don't think MagicString::indentStr is public because it is not written on docs nor type definitions.
But if someone is relying on this, it would break.


This PR delays executing guessIndent(originalContent).
This takes slightly long when the content is large.

before

node v16.15.0

construct x 5,154 ops/sec ±0.96% (95 runs sampled)
append x 7,987,412 ops/sec ±3.90% (62 runs sampled)
indent x 4,177 ops/sec ±0.57% (91 runs sampled)
generateMap (no edit) x 1,894 ops/sec ±0.95% (89 runs sampled)
generateMap (edit) x 1,843 ops/sec ±0.40% (93 runs sampled)
generateDecodedMap (no edit) x 1,954 ops/sec ±1.00% (91 runs sampled)
generateDecodedMap (edit) x 1,959 ops/sec ±0.59% (92 runs sampled)

after

node v16.15.0

construct x 80,654 ops/sec ±0.53% (93 runs sampled)
append x 7,852,165 ops/sec ±5.47% (58 runs sampled)
indent x 3,785 ops/sec ±0.53% (92 runs sampled)
generateMap (no edit) x 1,983 ops/sec ±0.50% (96 runs sampled)
generateMap (edit) x 1,979 ops/sec ±0.53% (94 runs sampled)
generateDecodedMap (no edit) x 2,185 ops/sec ±0.41% (94 runs sampled)
generateDecodedMap (edit) x 2,176 ops/sec ±0.45% (94 runs sampled)

@antfu
Copy link
Collaborator

antfu commented Jun 4, 2022

Can you make this PR orthogonal to #215 so we could have it first? For #215 I am discussing with Rich to have upstream improvements directly.

@sapphi-red
Copy link
Contributor Author

I made this orthogonal to it. 👍

@antfu antfu merged commit 69b13c7 into Rich-Harris:master Jun 5, 2022
@sapphi-red sapphi-red deleted the perf/delay-guess-encoded branch June 8, 2022 15:12
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

Successfully merging this pull request may close these issues.

None yet

2 participants