Cut redundant work in the graph mutation-apply path - #2321
Open
mcalancea wants to merge 6 commits into
Open
Conversation
Raw degree upper-bounds active degree, so a header read soundly skips candidates that cannot exceed M_limit; only potentially-oversized neighborhoods pay the decode and staleness filter.
Track the seq_no of the last op that can invalidate edges (RemoveNode, or AddNode re-minting a live serial). A neighborhood stamped at or after it holds no stale edge, so edit_neighborhood skips the per-entry content-clock probes. Derived, in-memory only; equality now compares semantic state so a conservatively seeded load equals its mint.
mcalancea
marked this pull request as ready for review
August 3, 2026 13:45
A loaded graph's history is unknown and legacy prune/migration can leave edges to serials absent from the content clock; seeding at last_update_seq_no let neighborhoods stamped at the load height skip their first filter, admitting restart-dependent state and phantom-edge resurrection. Seeding one past the load point forces one filtered touch per loaded neighborhood. Also assert the skip precondition in debug builds and destructure in PartialEq so new fields force a decision.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes to the mutation-apply hot path. No effect on the stored format, checkpoint layout, checksums, or mutation semantics.
Compaction scan: raw-degree guard.
compact_batchdecoded and staleness-filtered every candidate neighborhood to find the oversized ones. Raw degree — a header read on the encoded form — upper-bounds active degree, so candidates at or underM_limitare now skipped without decoding. Identical output.Staleness-filter watermark.
edit_neighborhoodran the per-entry content-clock filter on every touch.GraphMemnow tracks the seq_no of the last op that can invalidate existing edges (RemoveNode, or anAddNodere-minting a live serial); a neighborhood stamped at or after that watermark provably holds no stale edge, so the filter is skipped. The field is derived and in-memory only: loads seed it conservatively atlast_update_seq_no, replay maintains it deterministically, and the existingdebug_assertinedit_neighborhoodguards the skip.GraphMemequality now compares semantic state only (derived fields excluded), so a conservatively seeded load compares equal to its mint.Measured on a synthetic 17M-node graph on Graviton (x8g), single-threaded: applying a batch of 96 inserts with 320 bilateral links went from 1.64 s to 288 ms, and the compaction candidate scan from ~1.4 s to 1.3 ms. The benchmark harness lands separately.