-
Notifications
You must be signed in to change notification settings - Fork 366
Closed
Description
Hey,
Busy looking at improving build performance, specifically heavy use is being made of Traceur and compile times increase dramatically when sourcemap generation is enabled.
The usage pattern of SourceMapGenerator via Traceur is very predicable:
- Mappings always are always of the "size 4" variety (no name)
- Sources are all known in advance
- Mappings are all added in-order
Seems possible one could encode mapping strings greedily, skipping edge cases, intermediate representation, deferred computation etc.
Also imagine this usage pattern to be very common in other compilers. (The assumption of "no names" could relax to "name list known in advance" with only marginal extra overhead)
Perhaps something like the following:
class OptimizedSourceMapGenerator {
// Note that `sources` and `names` are now required
constructor(file, sourceFileRoot, sources, names, [sourcesContents])
// Assume (or assert) called with (generatedLine, generatedColumn) strictly ascending
// This is the only retained public method from regular implementation, beyond toString, toJSON
addMapping(generatedLine, generatedColumn, originalLine, originalColumn, source, name)
}Not sure how much this would impact performance, but have a hunch that it could be large!
Would appreciate feedback on whether:
- There seems to be merit in this approach, or whether you'd anticipate little improvement
- You have other suggestions
- PR welcome here for this, or best left as a 3rd party extension.
Metadata
Metadata
Assignees
Labels
No labels