Skip to content

[codex] perf: speed up warm snapshot reopen#222

Merged
justrach merged 3 commits intomainfrom
codex/warm-reopen-sidecars
Apr 9, 2026
Merged

[codex] perf: speed up warm snapshot reopen#222
justrach merged 3 commits intomainfrom
codex/warm-reopen-sidecars

Conversation

@justrach
Copy link
Copy Markdown
Owner

@justrach justrach commented Apr 8, 2026

Summary

  • restore snapshot outlines/state directly instead of reparsing every file on warm reopen
  • reuse persisted trigram sidecars for CLI and MCP loads, and lazily rebuild/persist the word index
  • skip redundant word.index rewrites and align the clean main-based branch with AnyTrigramIndex

Why

Warm snapshot startup was still spending seconds rebuilding indexes after loading codedb.snapshot. This keeps cold indexing effectively flat while making warm CLI and MCP startup dramatically faster.

Benchmarks

All numbers below are ReleaseFast and measured against v0.2.54 on the same machine. The broader benchmark appendix was added post-merge while preparing the 0.2.55 release.

Data Shape: Large Repo CLI (openclaw)

Benchmark 0.2.55 0.2.54 Delta
cold tree 5.32s 5.29s +0.6%
snapshot 6.53s 6.25s +4.6%
warm tree 0.26s 6.16s 23.7x faster
warm search workspace 0.24s 6.14s 25.6x faster
warm word session 0.61s 5.99s 9.9x faster

Data Shape: MCP First Secondary-Project Call (openclaw)

Tool 0.2.55 0.2.54 Delta
codedb_tree 0.076s 5.289s 69.6x faster
codedb_search 0.067s 5.278s 78.8x faster
codedb_word 0.285s 5.312s 18.6x faster

Data Shape: Peak RSS (openclaw)

Benchmark 0.2.55 0.2.54
cold tree 3478.8MB 3478.1MB
warm tree 192.6MB 3314.0MB
warm search 193.3MB 3312.9MB
warm word 677.1MB 3313.3MB

Data Shape: Small-Corpus Sanity (codedb/src)

Benchmark 0.2.55 0.2.54
cold tree 0.045s 0.040s
warm tree 0.010s 0.030s
warm search 0.010s 0.030s
warm word 0.010s 0.030s

Workload-Shaping Note

The release also includes WAL profiling and hashed cloud sync from #198 and #199, so production query/open patterns can be aggregated without sending raw query strings or file paths off-machine.

Validation

  • SDKROOT=$(xcrun --show-sdk-path) zig build test
  • SDKROOT=$(xcrun --show-sdk-path) zig build -Doptimize=ReleaseFast
  • SDKROOT=$(xcrun --show-sdk-path) zig build run -- --help

Closes #220.

@justrach justrach marked this pull request as ready for review April 9, 2026 01:46
@justrach justrach merged commit 59cc846 into main Apr 9, 2026
1 check failed
@justrach justrach deleted the codex/warm-reopen-sidecars branch April 9, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf: persist startup-critical indexes aggressively for mmap-backed warm reopen

1 participant