Skip to content

Core: reduce allocations in metrics.getMetrics#14769

Merged
patmmccann merged 1 commit intomasterfrom
codex/fix-performance-flaw
Apr 22, 2026
Merged

Core: reduce allocations in metrics.getMetrics#14769
patmmccann merged 1 commit intomasterfrom
codex/fix-performance-flaw

Conversation

@patmmccann
Copy link
Copy Markdown
Collaborator

Motivation

  • getMetrics() allocated a new object for each visited node during depth-first traversal which increased GC pressure on hot paths that repeatedly call metrics aggregation.

Description

  • Replace the per-node Object.assign({}, ...) allocations with a single mutable accumulator object and guarded writes via hasOwnProperty so nearest metrics keep precedence and includeGroups behavior is preserved.
  • Change made in src/utils/perfMetrics.ts (metrics aggregation path only).

Testing

  • Ran npx eslint --cache --cache-strategy content src/utils/perfMetrics.ts test/spec/unit/utils/perfMetrics_spec.js and it passed.
  • Ran npx gulp test --nolint --file test/spec/unit/utils/perfMetrics_spec.js and the spec suite passed (49 tests completed).

Codex Task

@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 24765613806

Coverage increased (+0.001%) to 96.39%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: 7 of 7 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 229272
Covered Lines: 220996
Line Coverage: 96.39%
Relevant Branches: 53201
Covered Branches: 43252
Branch Coverage: 81.3%
Branches in Coverage %: No
Coverage Strength: 72.75 hits per line

💛 - Coveralls

@patmmccann patmmccann merged commit 34591b3 into master Apr 22, 2026
113 checks passed
@patmmccann patmmccann deleted the codex/fix-performance-flaw branch April 22, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants