Skip to content

perf(backfill-hasher): traverse dependency queue with a cursor - #1256

Merged
Elizabeth Craig (ecraig12345) merged 1 commit into
microsoft:mainfrom
djordjem88:user/djmaks/lage-dependency-queue-cursor
Nov 6, 2026
Merged

Elizabeth Craig (ecraig12345) merged 1 commit into
microsoft:mainfrom
djordjem88:user/djmaks/lage-dependency-queue-cursor

Conversation

@djordjem88

Copy link
Copy Markdown
Contributor

Summary

Requested reviewers: Nemanja Tesic (@nemanjatesic) and Elizabeth Craig (@ecraig12345).

Replace repeated Array.shift() calls in external dependency resolution with an index that advances through the growing queue. Preserve FIFO traversal, the existing queued/processed sets, version-range resolution, resolved-version deduplication, and missing-package behavior.

Processed entries remain in the array until resolution returns. This avoids front-removal work at the cost of retaining those entries for the duration of the call.

Part of the broader Lage performance effort explored in #1238, following the queue-membership change already merged in #1248. This PR is based directly on current main and is independent of the other new performance PRs. Git file enumeration is deliberately excluded into its own PR.

Validation

  • Independent branch based on main at cf155216; extracted source and test files exactly match the previously validated implementation.
  • Final independent branch: all 26 backfill-hasher tests passed across six suites.
  • Added a broad shared/cyclic dependency graph case asserting FIFO result order and missing-leaf handling. Existing range, scoped-package, cycle, deduplication, and invocation-isolation cases remain.
  • Full local CI passed with the separate Git-enumeration optimization during implementation (30 successful targets, 91 cached/skipped, zero failures). This is not a claim about GitHub PR CI.
  • Includes a Beachball patch note. No end-to-end speedup claim.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7b26a45b-25aa-45e3-95b4-f9a1b55dcb58

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 the dependency-queue traversal optimization.

No open issues 🎉

What changed in this PR

Reduces queue-processing overhead in Lage’s backfill-hasher while preserving existing dependency-resolution behavior.

Changes:

  • Replaces repeated Array.shift() calls with cursor-based FIFO traversal, retaining processed entries until resolution completes.
  • Adds a wide, shared/cyclic graph test covering traversal order and missing-dependency handling.
  • Includes a Beachball patch release note.
File Description
packages/​backfill-hasher/​src/​resolveExternalDependencies.ts Advances a cursor through the growing dependency queue.
packages/​backfill-hasher/​src/​__tests__/​resolveExternalDependencies.test.ts Adds coverage for breadth-first ordering, shared dependencies, cycles, and a missing leaf.
change/​change-35380e06-8e55-441c-9a55-f1b507d6b01e.json Records the queue-traversal optimization as a patch release.

Review effort: Max

@ecraig12345
Elizabeth Craig (ecraig12345) merged commit c791069 into microsoft:main Nov 6, 2026
14 checks passed
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.

3 participants