Repository navigation
id-events: fold position queries use the memoised frontier, not a per-call index clone (#15142 slice) - #17551
Merged
Conversation
…frontier, not a per-call index clone The group fold judged every event's authority through Membership::access_at_position_shared, which clones the whole CausalIndex (every decided event plus the frontier memo) on every call because it borrows immutably. A fold of an n-event log made several such calls per event, and GroupLog::record folds the whole log per append, so building a group log cost O(n) folds x O(n) events x O(n) index clones. Propagate &mut through the fold's judge graph (apply/judge and the delegation judges were already &mut) so the position queries use Membership::access_at_position, which memoises frontiers in the index instead of copying it. Borrow-only change: no verdict logic moves. authorized_device_account collects its candidate grants before the mutable queries, and is_grantor_of_record copies the grant's group/grantor out first, both preserving iteration order and outcomes. Measured on the serve_group_warnings tests whose member counts are the thresholds under test (96/128), so no fixture cut is legitimate (#15142): baseline on main 56da0db, isolation, fleet runner — fire_once_at_each_size_threshold 12.393s, evaluate_custom_groups_log 5.191s (run 46478887061). After/before comparison follows in the PR. Refs #15142
…essor query (borrow fix for the fold &mut propagation)
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
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.
Refs #15142 — remainder slice (a) from lane 0900-AH's handoff: the
serve_group_warningstests, whose member counts (96/128) ARE the size thresholds under test, so no fixture cut is legitimate. This is the production-side fix AH called for.Root cause (evidenced by component bench)
GroupLog::recordfolds the whole log per append, and the fold judged every event's authority throughMembership::access_at_position_shared. That shared variant clones the entireCausalIndex— every decided event plus the frontier memo — on every call, because it borrows immutably (its own doc: "it copies the frontier index rather than memoising into it, so prefer the mutable method on a hot path"; fold.rs even admitted "This is the slow path: it does not use the membership layer's frontier memo"). Per member event the fold made ≥2 such calls (is_active_for+access_forineffective_author).Component bench (temporary test, since removed; fleet runner, 128-member log):
recordon the full logRuns 46490243711 (main) and 46490355803 (this branch's fix commits). A consistent −19/−20% across all three measures. The remaining fold cost is the membership layer's per-event position work (
state_atreplays, several queries per event at the same position) — recorded on #15142 as the next slice's starting point; this PR does not speculate at it.Fix
Propagate
&mutthrough the fold's judge graph (apply/judgeand the delegation judges were already&mut) so position queries use the memoisedMembership::access_at_position. Borrow-only change — no verdict logic moves:is_active_at/is_active_fortake the record's friendship/present facts as values, read by callers before the mutable borrow.authorized_device_accountcollects candidate grants before the mutable queries (iteration order preserved).is_grantor_of_recordcopies the grant's group/grantor out first and collects matching removals before callingsuccessors_of.Verification
serve_group_warningstests pass with thresholds and assertions untouched; the fullid-events,id-groups, andid-coresuites (the fold's verdict surface) pass in the same dispatch: 1631 passed / 0 failed (run 46485581212, pre-merge head; re-verified on the merged head in run 46494051603).{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-30T19:45:33Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch/workspace/github-work/code-15142-cl", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch/workspace/github-work/code-15142-cl", "repo": "developing-today/code", "branch": "xaltha/15142-group-warnings", "sha": "79e22bd2f21ddd9bd15d686085dde04a61261747" }, "auth_subject": "xaltha", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.