Perf: speed up LIVE recording hot path - #38
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
inspect.signatureper boundary; dataclass / message fast-path in_json_safemodel_constructon the LIVE pathJsonlStore(keep_open=True),retain_envelopes=Falseonrecord(), buffered open_store keeps the JSONL fd opendocs/testbench-bench-*.jsonBench (stub client, best_ms)
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.pyfrom testbench against local editable chronicleMade with Cursor