You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(cache): warm file-fact load re-serializes every FileFacts to verify its digest; cache is 429 MB of pretty JSON for 1,043 files #9216
Release build of origin/main 610dc11. target/ripr/cache/repo-file-facts/1.45 holds 1,043 entries totalling 429 MB (about 411 KB per entry; repo Rust source is 60 MB). Cold index_cached_parse 12.7 s then 4.4 s; warm 1.5-1.8 s per index build, run twice (so about 3.5 s of every warm check, mostly 4 cores).
Hotspot
load_file_facts (seam_cache.rs:2478): std::fs::read -> codec::decode_file_facts (serde_json deserialize, :2485/:3314) -> validate_integrity (:3200) -> expected_digest (:3197) -> semantic_body_digest (:3154), which serializes the whole FileFacts again with serde_json::to_writer into SHA-256. gdb samples of the warm path (g1 series, 8 of 30 samples) show deserialize and write@seam_cache.rs:3143 (the digest writer) interleaved. Entries are written with to_writer_pretty (:3123), inflating disk use and read/parse time; with disk this tight (1.1 GB free at times in the swarm hosts) 429 MB per workspace matters.
Proposed minimal fix
Verify integrity over the bytes already read (store the digest over the canonical compact body bytes and hash the slice before/while decoding) instead of re-serializing the decoded struct.
Write compact JSON (or a binary/zstd codec) instead of pretty JSON; bump the cache schema version.
Optionally read entries lazily per file only when the content hash key matches.
Checked the issue’s three proposed fixes against origin/main. No PR references #9216; stopping implementation because crates/ripr/src/analysis/seam_cache.rs is already touched by open PRs 10167, 11415, 12246, 12254, 12276, 12290.
1. Verify integrity from bytes already read (avoid re-serializing FileFacts on warm load)
Remaining. Warm Rust repo file-fact admission still deserializes the entry, then validate_integrity() recomputes the digest by serializing the decoded envelope again:
Related write-side improvement landed in #11643 (d2c283a2fd): store_file_facts borrows via FileFactCacheEnvelopeRef instead of cloning facts before encode — :3020-3037, test :5740-5756.
Remaining for Rust repo file facts. Entries still use encode_integrity_body → serde_json::to_writer_pretty — :3806-3814, :3749-3761; codec::encode_file_facts_ref calls that path — :3971-3974.
Done elsewhere: Python per-file facts use encode_integrity_body_compact — crates/ripr/src/analysis/language/python/fact_store.rs:449-450 (#10975 / 387f96eb81). Rust FILE_FACT_CACHE_SCHEMA_VERSION is 1.51 (:1177) vs the issue’s 1.45 measurement snapshot, but generation bumps track analyzer semantics, not compact encoding.
3. Optional lazy per-file reads
Partially addressed for miss attribution, not full lazy warm load.known_file_paths / read_file_fact_header read only an 8 KiB prefix (or header fields) for inventory — :2988-3017, :3315-3334. Each warm hit still fully reads and decodes the body in load_file_facts.
Verdict: perf hotspot largely still present on the Rust repo file-fact path; adjacent cache work landed but does not close the issue. Not opening a PR from this pass due to open seam_cache.rs overlap.
Compact Rust file-fact storage slice owned by PR #12941, head 2301b46. Independent exact-head review and final owner review are REVIEW_READY; required qualification run 41800326630 passed, including all four test shards and complete/disjoint/green cover verification. Local cache suite: 220 passed. Measured sample bytes: 252,488 pretty -> 155,282 compact (38.5% smaller), with legacy/current admission, semantic integrity and bounded CLI output parity preserved. No production speed/CPU/RSS claim; wholesale cache removal is not included.
Landing is pending: ordinary protected expected-head squash returned HTTP 502; readback showed open/unmerged. One retry after readback returned HTTP 405 “Merge already in progress.” Latest readback still open/unmerged and main 9d730b2. No further merge requests issued. Parent owns next observation of GitHub's transition and verification of remote landing. No source writer/build remains active.
This is a bounded encoding/storage improvement, not completion of #9216. Digest reserialization, lazy loading and remaining issue acceptance stay open. Source, local validation logs and reusable build artifacts retained for parent verification; no release/publication performed.
Compact Rust file-fact storage slice is now on main via #12941, protected squash af3da61. Readback confirms the merge, parent 1ab2921 and exact reviewed tree c028b592c1dfa954e9a9c82705bad6e46f503c0d. Both Rust entry encoders use the existing compact JSON codec; legacy admission, semantic digest and inventory behavior are preserved. Recorded sample bytes fall 252,488→155,282 (38.5%); this is not an end-to-end runtime, RSS, filesystem-block or token-efficiency result. Unchanged-head native/hosted proof and current integration review are linked in the PR. Digest reserialization, lazy loading and other parent acceptance remain open; no new release claim.
Claiming item 1 (digest re-serialization on warm Rust file-fact loads) from the feedback-latency thread. Approach mirrors #13292 for Python: entries are framed as <digest>\n<compact body> and verified by hashing the stored body bytes, with the existing re-serializing check kept only for unframed entries; schema 1.58 -> 1.59. Callgrind on a ripr-swarm warm check attributed ~20% of instructions to validate_integrity. Draft PR with before/after timings to follow. Lazy loading stays open.
Source-only clarification for the existing #14361 owner at f56b164b8b473031814c7625525b5368eccd9fdb, linked to the retained diagnostic receipt. No new candidate measurement or speedup claim.
The retained dev-build measurements use source e993b4e59095fa4702ebf37e464efedf7b0e0759 and diagnostic tree fd66a48aebd394a0c1a3586a486a8f2ab2db16b1. Their digest/encoding subtotals describe fresh fact stores, not warm-read verification: cold 10.565/11.219 seconds; partially warm follow-up 5.217/5.724 seconds while storing another 701 files. These totals must not be treated as recoverable wall time or compared directly with the PR's separate release warm-cache benchmark.
Two distinct source implications:
Fresh writes: the measured encoder computes an envelope digest through serialization, then encodes the envelope. The candidate encoder serializes the body once and frames a digest over those bytes. It therefore overlaps part of the measured fresh-store work, beyond its stated warm-read purpose. Net benefit is unmeasured: hashing, one serialization, allocation/copying and disk I/O remain.
Warm reads: the candidate decoder verifies framed stored bytes without reserializing decoded facts. JSON decoding remains; the unframed fallback still reserializes. The schema change also means an old cache is not a fully warm candidate population.
Source parsing, broad initial fact preparation and later classification remain separate. Any future matched comparison needs instrumentation adapted to the new framing and equivalent cache populations; neither was performed here. Existing ownership, integrity/identity checks, claim limits and the #13899 composition order are unchanged. No implementation, benchmark, CI request, queue action or issue closure accompanies this note.
#14675 landed as 8a40560e, closing the remaining required item here.
Item 1 (verify over the bytes already read): done by perf(cache): verify Rust file-fact entries over stored bytes (#9216) #14675. Rust file-fact entries are stored as <digest>\n<compact body>, and warm reads hash the stored body bytes instead of re-serializing the decoded FileFacts. Identity is still judged first, a digest mismatch is CorruptIgnored, and unframed entries keep the old re-serializing check. File-fact schema is 1.61.
Item 3 (lazy per-file reads): marked optional in this issue and not done; the header-only known_file_paths snapshot already avoids decoding bodies up front.
On a cold scoped check of #14675's own diff, release builds took 895 s without the change and 817 s with it, with byte-identical findings. Closing as completed; item 3 can get its own issue if it becomes worth doing.
Activity
EffortlessSteven commentedon Nov 2, 2026
Cursor verify claim: checking whether #9216 is satisfied on main.
EffortlessSteven commentedon Nov 2, 2026
Cursor verify result: partial (main
3f109cb34344993135c4882115509f5f81a675d5)Checked the issue’s three proposed fixes against
origin/main. No PR references#9216; stopping implementation becausecrates/ripr/src/analysis/seam_cache.rsis already touched by open PRs 10167, 11415, 12246, 12254, 12276, 12290.1. Verify integrity from bytes already read (avoid re-serializing
FileFactson warm load)Remaining. Warm Rust repo file-fact admission still deserializes the entry, then
validate_integrity()recomputes the digest by serializing the decoded envelope again:load_file_facts: read →codec::decode_file_facts→envelope.validate_integrity()—crates/ripr/src/analysis/seam_cache.rs:2940-2974FileFactCacheEnvelope::validate_integrity→expected_digest→semantic_body_digest(...)(second JSON serialize) —:3854-3860,:3765-3791Related write-side improvement landed in #11643 (
d2c283a2fd):store_file_factsborrows viaFileFactCacheEnvelopeRefinstead of cloning facts before encode —:3020-3037, test:5740-5756.2. Compact on-disk JSON (not pretty) + schema bump for repo file facts
Remaining for Rust repo file facts. Entries still use
encode_integrity_body→serde_json::to_writer_pretty—:3806-3814,:3749-3761;codec::encode_file_facts_refcalls that path —:3971-3974.Done elsewhere: Python per-file facts use
encode_integrity_body_compact—crates/ripr/src/analysis/language/python/fact_store.rs:449-450(#10975 /387f96eb81). RustFILE_FACT_CACHE_SCHEMA_VERSIONis1.51(:1177) vs the issue’s1.45measurement snapshot, but generation bumps track analyzer semantics, not compact encoding.3. Optional lazy per-file reads
Partially addressed for miss attribution, not full lazy warm load.
known_file_paths/read_file_fact_headerread only an 8 KiB prefix (or header fields) for inventory —:2988-3017,:3315-3334. Each warm hit still fully reads and decodes the body inload_file_facts.Verdict: perf hotspot largely still present on the Rust repo file-fact path; adjacent cache work landed but does not close the issue. Not opening a PR from this pass due to open
seam_cache.rsoverlap.EffortlessSteven commentedon Nov 4, 2026
Compact Rust file-fact storage slice owned by PR #12941, head 2301b46. Independent exact-head review and final owner review are REVIEW_READY; required qualification run 41800326630 passed, including all four test shards and complete/disjoint/green cover verification. Local cache suite: 220 passed. Measured sample bytes: 252,488 pretty -> 155,282 compact (38.5% smaller), with legacy/current admission, semantic integrity and bounded CLI output parity preserved. No production speed/CPU/RSS claim; wholesale cache removal is not included.
Landing is pending: ordinary protected expected-head squash returned HTTP 502; readback showed open/unmerged. One retry after readback returned HTTP 405 “Merge already in progress.” Latest readback still open/unmerged and main 9d730b2. No further merge requests issued. Parent owns next observation of GitHub's transition and verification of remote landing. No source writer/build remains active.
This is a bounded encoding/storage improvement, not completion of #9216. Digest reserialization, lazy loading and remaining issue acceptance stay open. Source, local validation logs and reusable build artifacts retained for parent verification; no release/publication performed.
perf(cache): compact Rust file-fact storage (#9216) (#12941)
EffortlessSteven commentedon Nov 7, 2026
Compact Rust file-fact storage slice is now on main via #12941, protected squash af3da61. Readback confirms the merge, parent 1ab2921 and exact reviewed tree c028b592c1dfa954e9a9c82705bad6e46f503c0d. Both Rust entry encoders use the existing compact JSON codec; legacy admission, semantic digest and inventory behavior are preserved. Recorded sample bytes fall 252,488→155,282 (38.5%); this is not an end-to-end runtime, RSS, filesystem-block or token-efficiency result. Unchanged-head native/hosted proof and current integration review are linked in the PR. Digest reserialization, lazy loading and other parent acceptance remain open; no new release claim.
EffortlessSteven commentedon Nov 11, 2026
Claiming item 1 (digest re-serialization on warm Rust file-fact loads) from the feedback-latency thread. Approach mirrors #13292 for Python: entries are framed as
<digest>\n<compact body>and verified by hashing the stored body bytes, with the existing re-serializing check kept only for unframed entries; schema 1.58 -> 1.59. Callgrind on a ripr-swarm warm check attributed ~20% of instructions tovalidate_integrity. Draft PR with before/after timings to follow. Lazy loading stays open.Generated by Claude Code
test(cache): adapt entry-reading tests to framed file-fact entries (#…
EffortlessSteven commentedon Nov 13, 2026
Source-only clarification for the existing #14361 owner at
f56b164b8b473031814c7625525b5368eccd9fdb, linked to the retained diagnostic receipt. No new candidate measurement or speedup claim.The retained dev-build measurements use source
e993b4e59095fa4702ebf37e464efedf7b0e0759and diagnostic treefd66a48aebd394a0c1a3586a486a8f2ab2db16b1. Their digest/encoding subtotals describe fresh fact stores, not warm-read verification: cold 10.565/11.219 seconds; partially warm follow-up 5.217/5.724 seconds while storing another 701 files. These totals must not be treated as recoverable wall time or compared directly with the PR's separate release warm-cache benchmark.Two distinct source implications:
Source parsing, broad initial fact preparation and later classification remain separate. Any future matched comparison needs instrumentation adapted to the new framing and equivalent cache populations; neither was performed here. Existing ownership, integrity/identity checks, claim limits and the #13899 composition order are unchanged. No implementation, benchmark, CI request, queue action or issue closure accompanies this note.
EffortlessSteven commentedon Nov 15, 2026
#14675 landed as
8a40560e, closing the remaining required item here.<digest>\n<compact body>, and warm reads hash the stored body bytes instead of re-serializing the decodedFileFacts. Identity is still judged first, a digest mismatch isCorruptIgnored, and unframed entries keep the old re-serializing check. File-fact schema is1.61.known_file_pathssnapshot already avoids decoding bodies up front.On a cold scoped check of #14675's own diff, release builds took 895 s without the change and 817 s with it, with byte-identical findings. Closing as completed; item 3 can get its own issue if it becomes worth doing.
Generated by Claude Code