Speed up snapshot JSON generation#325
Conversation
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f6f12b6c40
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var ski = explorer.symbol_index.iterator(); | ||
| while (ski.next()) |e| try sym_keys.append(alloc, e.key_ptr.*); |
There was a problem hiding this comment.
Rebuild symbol index from outlines before snapshot emit
This change serializes symbol_index directly from explorer.symbol_index, but that map is not guaranteed complete after fast snapshot restore: insertRestoredFile (src/snapshot.zig) restores outlines/content without calling rebuildSymbolIndexFor, and findAllSymbols explicitly documents that symbol_index can be incomplete after this path (src/explore.zig, comment around lines 1325-1328). In warm-start loads, many unchanged files follow that restore path, so buildSnapshot now returns a partial or empty symbol_index even when outlines are present. Please retain an outline-based fallback (as before) when emitting snapshot symbol data.
Useful? React with 👍 / 👎.
Summary
Explorer.symbol_indexdirectly instead of rebuilding a temporary symbol map for every snapshot callLocal benchmark
Compared this branch against
origin/release/0.2.579withscripts/compare-bench.py:codedb_snapshot:938750 ns->575900 ns(-38.65%,-362850 ns)The benchmark corpus includes
src/snapshot_json.zig, so the snapshot payload grew slightly from the code change itself, but latency still dropped substantially.Validation
zig build testzig buildpython3 scripts/run-bench-json.py /tmp/codedb-head-bench.json/tmp/codedb-release-baseatorigin/release/0.2.579