SourceMap generation is unnecessarily slow
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 17k
- Forks
- 3.4k
- Avg merge
- 7h 42m
- Merged PRs (30d)
- 26
Description
We recently noticed that if we remove sourcemap generation from our build process, the build speeds up from around 15s -> 5s.
When we ran it through the profiler, we noticed that a lot of time is being spent in SourceMapOutput#add. In particular, every time we add a mapping, it has to iterate through the source file and split it into sourceLines. It does this over and over again for the same file.
https://github.com/less/less.js/blob/master/lib/less/source-map-output.js#L57
are there any plans to speed this up? Would you accept a pull request to fix this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/less/source-map-output.js at SourceMapOutput#add, especially the line linked in the issue, and profile the build to confirm the repeated source-file splitting. Done means source-map generation no longer repeatedly processes the same file and the build is measurably faster; compare the result with the reported 15s versus 5s build times.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100