Repository navigation
Read the barretenberg prover state with one jq call - #319
Merged
alxkzmn merged 1 commit intoOct 28, 2026
Merged
Conversation
`prove.sh` is the region hyperfine times, so every subprocess it spawns is charged to barretenberg's proving time. It parsed `STATE_JSON` with five separate `jq` invocations, which cost about 11 ms of the ~13 ms the script spent before reaching `nargo`. Reading all five fields from one `jq` call takes that to about 3 ms, a median saving of 8.65 ms per invocation measured over 40 runs on an M2. Against the smallest published barretenberg figure -- 158.9 ms for poseidon2 at input size 2 -- that is roughly 5% of the reported proving time. `input-size` now falls back to the empty string rather than `empty` so the field always occupies a line and the reads stay aligned; the resulting value is the same empty string the old `// empty` produced, so the existing `[[ -n "$INPUT_SIZE" ]]` branch is unchanged. Differentially tested against the previous parsing on three inputs -- with `input-size`, without it, and with spaces in every path -- byte-identical output and the same exit status in each case, under both bash 5 and the macOS system bash 3.2. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Oct 27, 2026
alxkzmn
self-requested a review
October 28, 2026 14:12
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.
Read all five
STATE_JSONfields with onejqinvocation inbarretenberg/prove.sh, reducing subprocess overhead inside the timed proving command. Emit an empty line wheninput-sizeis absent so the field reads remain aligned.A local parsing benchmark on an M2, with 40 runs per version including Bash startup, reduced median time from 13.39 ms to 4.74 ms.
Validation: equivalent parsed output with and without
input-size, and with spaces in paths, under Bash 3.2 and 5.bash -npassed.Addresses #26 (1).