Hypothesis
In Workload B, each of the 250 files creates a new LazyResult (lazy-result.js constructor). The constructor performs several steps that are identical across all files when using the same Processor: plugin normalization, Result construction, helpers object assembly, warning/message array creation.
Move per-Processor setup to a lazy-initialized cache on Processor:
- Normalize plugins once on Processor, not per LazyResult
- Create the helpers object template once, clone for each file
- Pre-compute the plugin type checks (object vs function) once
The LazyResult constructor then only does per-file work: set the CSS string, root node, opts, and shallow-clone the cached helpers.
Editable surface
- lib/lazy-result.js — slim down constructor, use cached Processor data
- lib/processor.js — add lazy-init caches for normalized plugins and helpers template
What's different from prior work
Expected impact
METRIC_B improvement of 3-5ms from eliminating redundant per-file constructor work across 250 files.
Hypothesis
In Workload B, each of the 250 files creates a new LazyResult (lazy-result.js constructor). The constructor performs several steps that are identical across all files when using the same Processor: plugin normalization, Result construction, helpers object assembly, warning/message array creation.
Move per-Processor setup to a lazy-initialized cache on Processor:
The LazyResult constructor then only does per-file work: set the CSS string, root node, opts, and shallow-clone the cached helpers.
Editable surface
What's different from prior work
Expected impact
METRIC_B improvement of 3-5ms from eliminating redundant per-file constructor work across 250 files.