Hypothesis
Combining four independent formatArgs and common.js optimizations from prior non_improvement attempts can achieve a compound improvement exceeding 3ms. Prior attempts (#5, #6, #11, #12, #13) each showed improvements on the Hetzner contributor hardware but were individually or in triples below 3ms on the Mac Mini baseline. Adding a fourth optimization (lazy prev/curr) may push the combined effect over the threshold.
Rationale
Results history shows these optimizations each have real effects but individually sub-threshold:
- Pre-compute color prefix at init: saves 2-3 string concats/call
- Short-circuit split/join for no-newline messages: avoids array alloc for 75% of calls
- Cache ms.humanize for repeated diffs: skips ms library for repeated diffs
- Lazy prev/curr via getters: removes 2 property writes per call
Combined, these target 4 independent bottlenecks in the enabled path. The compound effect should exceed any individual optimization.
Scope
- src/node.js init(): cache _colorCode, _colorPrefix, _lastDiff, _lastHumanized
- src/node.js formatArgs(): use cached prefix, indexOf newline guard, humanize cache
- src/common.js: replace self.prev/self.curr with lazy getters, remove per-call writes
Expected impact
Moderate to high. Each optimization saves ~0.5-1.5ms on the Mac Mini; combined they should exceed 3ms.
Risks
Must verify no interaction between common.js and node.js changes. Each targets independent code paths so interference is unlikely.
Hypothesis
Combining four independent formatArgs and common.js optimizations from prior non_improvement attempts can achieve a compound improvement exceeding 3ms. Prior attempts (#5, #6, #11, #12, #13) each showed improvements on the Hetzner contributor hardware but were individually or in triples below 3ms on the Mac Mini baseline. Adding a fourth optimization (lazy prev/curr) may push the combined effect over the threshold.
Rationale
Results history shows these optimizations each have real effects but individually sub-threshold:
Combined, these target 4 independent bottlenecks in the enabled path. The compound effect should exceed any individual optimization.
Scope
Expected impact
Moderate to high. Each optimization saves ~0.5-1.5ms on the Mac Mini; combined they should exceed 3ms.
Risks
Must verify no interaction between common.js and node.js changes. Each targets independent code paths so interference is unlikely.