Skip to content

Wave 4 / Search: query latency floor — full posting-blob CRC32 on every index open (reader.rs) #376

Description

@dean0x

Wave: wave4-search-followups
Depends on: #380

flowchart LR
  T372["1. #372 lexical AND-intersect"]
  T373["2. #373 FileId skew"]
  T374["3. #374 AST verify gate"]
  T375["4. #375 remove index positional"]
  T377["5. #377 weights notice"]
  T380["6. #380 binarize + positional"]
  T376["7. #376 CRC marker"]
  T379["8. #379 worktree staleness"]
  T378["9. #378 risk volume weighting"]
  T381["10. #381 index-location docs"]
  T372 --> T373 --> T374 --> T375 --> T377 --> T380 --> T376 --> T379 --> T378 --> T381
  T373 -. requires .-> T374
  T373 -. requires .-> T380
  T380 -. requires .-> T376
  T375 -. requires .-> T377
  classDef cur fill:#dcffe4,stroke:#1a7f37,stroke-width:3px;
  class T376 cur;
Loading

Solid arrows = integration order into wave/wave4-search-followups. Dotted = hard dependency. One branch per ticket; this ticket highlighted.

Found via dog-fooding round 2 (2026-06-27, branch wave/wave4-search), tracked under #174 Wave 4. Priority: P1.

Problem: Query latency is median 57 ms / p90 77 ms (only 2/36 samples under the <50 ms target). The floor is a fixed per-open cost independent of result count.

Evidence: latency scales with .skpost size across corpora (townhall 9 ms / devflow 15 ms / skim-search 48 ms). Literal trigram: skim 70 ms wall vs ripgrep <10 ms, git grep 30 ms.

Root cause: crates/rskim-search/src/index/reader.rs:130-132 (added by #364) CRC32-hashes the entire post_mmap (40.7 MB here) on every open(), before any query runs.

Best fix: stop re-hashing the whole blob per query. Options: (a) verify CRC once at build / first-open and persist a validity marker keyed on (path, mtime, size); (b) segment the checksum and verify only segments actually touched; (c) make full verification opt-in (--verify-integrity) and rely on mmap otherwise. Restores <50 ms.

Refs: #358, #364, #174.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsearchCode search featurewave-4Wave 4: Compound queries

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions