Repository navigation
perf(owner-pin): fan the workspace constant table parse out off the pool - #14880
Conversation
The workspace const/static table parsed every corpus file on one thread. On a cold `ripr check` the single-seam review stage builds it on the main thread over the whole-workspace index, where it was most of that stage's ~10.7 s. Route the independent per-file parses through `map_scans`, so off the pool they fan out over rayon and on a pool worker they stay in line under the #8756 memo-lock guard. Rows fold in index file order, so the table and the check output are unchanged (#12947). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UNUoLWvJLNTjPAkUKhsj5V
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 20 minutes. View limit details
|
EffortlessSteven
left a comment
There was a problem hiding this comment.
SOURCE_REVIEW_READY
Head: c62cc6d. Reviewed read-only by a fresh reviewer who did not write the change; nothing blocks.
Equivalence. The old loop pushed every row into BTreeMap<String, Vec<_>> in index order without deduplicating. Consumers such as single_constant_value treat multiple matches as ambiguous. The new code collects index.files() once, and map_scans keeps index order on both branches. The fold zips the rows back and pushes them the same way. The per-file row order, the macro-call and text-read paths, and the r# strip are unchanged. The old continues became early returns in file_constants.
Re-entrancy. On a pool worker map_scans stays serial (#8756 guard). Off the pool, the caller holds the OnceLock init for workspace constants, and the workers never touch that memo or any borrowed RefCell. The thread-locals on the parse path are pure memos keyed by text (MASK_MEMO), so where a parse runs changes hit rates only, never output. The same exposure already exists for the map_scans macro scan.
Tests. the_workspace_constant_table_fans_out_off_the_pool_with_the_same_table fails with left: None, right: Some(true) when the change is reverted. It pins the serial path on a pool worker and that the off-pool and pool tables are equal. It also pins cross-file row order, including a file read only as text, plus the macro path and a file that adds no rows.
Proof:
cargo test -p ripr --lib classify::owner_pinpasses (407 tests).cargo xtask precommitexits 0.- JSON
cmpis identical on 3 cold pairs and warm. - The cold single-seam stage drops from 10.7 s to 5.7 s.
- Not run locally: the full workspace tests, clippy and Windows, which hosted CI covers.
Generated by Claude Code
Summary
ripr check(emptyRIPR_CACHE_DIR), the single-seam review stage runs on the main thread over the whole-workspace index. Most of that stage went toworkspace_constant_table, which parses every corpus file that containsconstorstatic, one file after another on one thread. gdb samples put it at 4 of the 6 samples in that stage.map_scans. Off the pool they fan out over rayon. On a pool worker they stay in line under the perf: share RelatedTestCandidateIndex memos across threads so per-probe classify can run in parallel (#8629 follow-up) #8756 memo-lock guard, so there is no new nested-parallelism risk. Rows are folded back in index file order, so the table and the output stay byte-identical.Swarm / Source Boundary
dependency, or repo-ops development for
ripr-swarmsurface
Source-of-truth Links
Proposal: n/a
Spec: n/a
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #12947
Acceptance delta (one sentence): The cold
ripr checksingle-seam review stage builds the workspace constant table over the rayon pool rather than on one thread. On the 216-seam ripr-swarm diff at 1e6f55b this cuts that stage from about 10.7 s to about 5.7 s, and the JSON output stays byte-identical.Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication):
perf/cold-checkStack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a
No open or merged PR touches
workspace_constant_table. A search forworkspace_constant_table,single_constant_valueandworkspace_constantsfound only the closed #8077, #8533, #8873, #8915 and #8963. This change is separate from #13911, #14850, #13850, #14214 and #14865.Scope
crates/ripr/src/analysis/classify/owner_pin.rs:workspace_constant_tablenow maps a new per-filefile_constantsthroughmap_scansand folds the results in file order.Scope Classification
Production delta:
Evidence/support delta:
the_workspace_constant_table_fans_out_off_the_pool_with_the_same_table.Single acceptance criterion:
Non-goals:
Support-tier Impact
docs/status/SUPPORT_TIERS.mdClaim/proof notes:
Policy Impact
Ledger or exception notes:
Proof
A/B, three alternating cold pairs (base
b7191cdee9against this head), plus one warm run each:evidence_for_seams_progress processed_1_of_1trace phase. It drops by a mean of 5.0 s, about 5.5% of cold wall time.cmpshows the JSON is byte-identical between base and fix for all three cold pairs and for warm, and identical between warm and cold.Negative experiment: I restored
owner_pin.rstoorigin/mainand kept the new test. The test then fails withthe per-file constant scan from a thread outside the pool must fan out(left: None, right: Some(true)). With the fix restored it passes.Result, failures, or skipped proof:
CARGO_BUILD_JOBS=1the filtered runs above completed.Claim Boundary
May claim: the cold single-seam review stage on this diff is about 5 s faster, and output is unchanged.
Must not claim: a general cold-check speedup beyond this stage, or any change to warm behaviour.
Other cold-only costs observed but not addressed here:
index_cached_parse: about 12 s cold against 2.2 s warm;diff_drop_unreached_test_filesmodule-tree parses: 5.1 s against 0.9 s;evidence_contextover 30,669 tests: about 8.9 s.Rollback
Revert this commit. The change is self-contained.
Spec-Test-Code Traceability
analysis::classify::owner_pin::tests::the_workspace_constant_table_fans_out_off_the_pool_with_the_same_tablecrates/ripr/src/analysis/classify/owner_pin.rs(workspace_constant_table,file_constants)map_scansStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
cargo fmt --checkcargo xtask precommitGenerated by Claude Code