Skip to content

Dispatch fingerprint callbacks only to matching source lines - #4295

Open
dsyme wants to merge 1 commit into
github:mainfrom
dsyme:perf/line-indexed-fingerprint-callbacks
Open

dsyme wants to merge 1 commit into
github:mainfrom
dsyme:perf/line-indexed-fingerprint-callbacks

Conversation

@dsyme

@dsyme dsyme commented Nov 3, 2026

Copy link
Copy Markdown

Summary

Index fingerprint callbacks by source line within each file instead of invoking every result callback for every emitted line hash. Files are still hashed once and the rolling hash and fingerprint format are unchanged.

This removes the lines-times-results callback dispatch cost on files with many findings, including the repeated Object.values array creation. Multiple results on the same line still receive the same fingerprint; inconsistent existing fingerprints are preserved and still generate warnings.

Validation

  • Add an upstream regression fixture covering duplicate line locations, different lines, out-of-range locations, and inconsistent existing fingerprints.
  • npm run ava -- src/fingerprints.test.ts: 5 tests passed, including existing golden SARIF/hash fixtures.
  • ESLint on changed TypeScript passed.
  • npm run build: typecheck and bundle generation passed; regenerated lib/entry-points.js is included.
  • Change-note validation passed.

Validated locally with Node 24.22.2. This PR makes no whole-analysis or fleet savings claim.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI auto review requested due to automatic review settings November 3, 2026 18:38
@dsyme
dsyme requested a review from a team as a code owner November 3, 2026 18:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the SARIF fingerprint dispatch optimization.

No open issues 🎉

1 file not reviewed
What changed in this PR

Optimizes SARIF fingerprint generation by dispatching each source-line hash only to matching results, while preserving the existing hash algorithm and fingerprint behavior.

Changes:

  • Indexes callbacks by line within each file, avoiding per-line iteration over every result.
  • Adds regression coverage for duplicate locations, different lines, out-of-range locations, and preservation of inconsistent existing fingerprints with warnings.
  • Adds a changenote describing the performance improvement.
File Description
unreleased-change-notes/​fingerprint-callback-dispatch.md Documents faster fingerprint generation without changing fingerprints.
src/​fingerprints.ts Groups callbacks by source line for targeted dispatch.
src/​fingerprints.test.ts Tests matching-line dispatch and preserved edge-case behavior.

Review effort: Balanced (auto)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants