Fix unreasonably slow bundle time on sourcemaps with long lines #2228
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1553. Fixes #1700.
For some builds like in the issues above,
traceSegment
incollapseSourcemaps.ts
took unreasonably long time because some of the source maps contained very long lines (e.g. one example line had 50k segments), and linearly searching through them for every segment that needed tracing was too slow. This PR switchestraceSegment
to use simple binary search, fixing the issue.Bundle times for the repro case in #1553:
sourceMap: false
(master
rollup): 2.1ssourceMap: true
(master
rollup): 15.5ssourceMap: true
(this branch): 2.4scc @lukastaegert