Skip to content

Perf: speed up LIVE recording hot path - #38

Merged
susheem-k merged 2 commits into
feat/chronicle-enabled-flagfrom
feat/perf-recording
Aug 5, 2026
Merged

Perf: speed up LIVE recording hot path#38
susheem-k merged 2 commits into
feat/chronicle-enabled-flagfrom
feat/perf-recording

Conversation

@susheem-k

Copy link
Copy Markdown
Contributor

Summary

  • Cache inspect.signature per boundary; dataclass / message fast-path in _json_safe
  • Build envelopes with model_construct on the LIVE path
  • JsonlStore(keep_open=True), retain_envelopes=False on record(), buffered open_store keeps the JSONL fd open
  • Testbench offline bench results in docs/testbench-bench-*.json

Bench (stub client, best_ms)

workload off on buffered
mas1 (LangGraph) 8.04 9.26 (1.15×) 8.31 (1.03×)
mas2 (plain loop) 0.20 3.19 (15.6×) 1.73 (8.5×)

mas2 relative factor stays high because the stub run is ~0.2ms; absolute Chronicle cost is ~1.5ms/run. Against real LLM latency that is negligible.

Test plan

  • pytest tests/ (130 passed)
  • PYTHONPATH=src python scripts/bench_chronicle.py from testbench against local editable chronicle

Made with Cursor

susheem-k and others added 2 commits August 4, 2026 23:39
Cache boundary signatures, use model_construct on envelope build, add JsonlStore keep_open and retain_envelopes=False for store-only buffered recording.

Co-authored-by: Cursor <cursoragent@cursor.com>
Flush stores on record() exit, restore batches after failed writes, and keep full message metadata when coercing inputs to JSON-safe dicts.

Co-authored-by: Cursor <cursoragent@cursor.com>
@susheem-k
susheem-k merged commit 9aae085 into feat/chronicle-enabled-flag Aug 5, 2026
3 of 4 checks passed
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.

1 participant