perf: Only extract source map comments at the end of the file#18039
Conversation
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61771 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9980eb58c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
commit: |
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Technically if a source map comment is followed by code we should ignore it.
So it should be enough to scan from the end, and only the trailing comments.
Maybe we could even start doing it at the parser level at some point.
|
@liuxingbaoyu I pushed a commit to further limit which comments we look at, so that we match the spec :) |
Fixes #1, Fixes #2Potential impact:
Currently, if users do not enable
sourceMaps, source map comments in the code will be retained.If some tools directly concatenate the source code and map within functions, they will no longer be loaded. (However, we only load one source map anyway.)
This greatly improves core performance: ~20%
Closes #16874