feat(perf): automated Pluto-vs-Charon benchmark harness + first optimization pass#551
Open
varex83 wants to merge 3 commits into
Open
feat(perf): automated Pluto-vs-Charon benchmark harness + first optimization pass#551varex83 wants to merge 3 commits into
varex83 wants to merge 3 commits into
Conversation
One command (perf/run.sh) runs matching workloads on both implementations, normalizes the results, and renders a report flagging every pair where Pluto is slower than Charon (ratio > 1.15 -> SUBOPTIMAL). - Tier 1 (pure compute): criterion benches for BLS tbls, FROST DKG rounds, SSZ codecs, protobuf, plus canonical ids for the existing k1util bench; Go counterparts live in a separate perf/go-bench module that consumes the vendored charon source via replace directives (charon/ stays pristine). - Tier 2 (in-memory): full QBFT consensus instance benches on both sides with mirrored topologies; in-memory FROST DKG ceremony (Rust-only) via a new bench-util feature exposing the test harness in pluto-dkg. - Tier 3 (process level): hyperfine matrix for create enr/cluster, peak RSS capture, and timed all-pluto vs all-charon DKG ceremonies through scripts/dkg-runner. - Shared binary fixtures in perf/fixtures generated by the Go side; the Rust benches assert a byte-identical round-trip before timing. - perf.yml workflow: nightly + on-demand tiers 1+2, report in the job summary, artifact upload, baseline regression gating (exit 2) once perf/baseline.json is committed.
First optimization pass over the harness findings (perf/FINDINGS.md): - blst_impl: Lagrange signature interpolation now uses blst Pippenger multi-scalar multiplication with a single final affine conversion instead of one scalar mult plus one field-inversion-costing affine conversion per share. Polynomial evaluation (threshold_split) and secret interpolation (recover_secret) moved to fr-domain Horner/dot-product arithmetic; fr copies of secret material are volatile-wiped (SecretFrVec drop guard). - pluto-frost: same Pippenger treatment in BlsSignature::from_partial_signatures, with batch affine conversion. - ssz_codec: all encoders pre-size output buffers via ssz_bytes_len; versioned encoders append the payload directly after the header instead of encoding into a temporary Vec and copying; the unsigned Deneb/Electra/Fulu proposal path no longer deep-clones the block, KZG proofs and blobs to serialize (borrowing *BlockContentsRef structs). - Release profile: thin LTO + codegen-units=1 (~6-12% on pure-Rust paths, measured; no effect on blst-bound ones). Measured (Apple M3 Pro, vs charon v1.7.1 herumi): - tbls/threshold_aggregate 3-of-4: 407us -> 205us (charon 300us) - tbls/threshold_aggregate 7-of-10: 951us -> 404us (charon 792us) - frost/aggregate: 346us -> 148us (charon 300us) - tbls/threshold_split 7-of-10: 15.1us -> 10.0us - tbls/recover_secret 7-of-10: 14.5us -> 10.1us All five previously SUBOPTIMAL aggregation pairs now beat charon; split/ recover remain ~2x (checked per-share validation and HKDF-based coefficient keygen, kept deliberately). Error semantics preserved throughout.
Pin dtolnay/rust-toolchain and Swatinem/rust-cache to immutable commit SHAs to resolve CodeQL unpinned-action alerts. Co-authored-by: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.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
Two commits: a fully automated performance-comparison harness against Charon, and the first optimization pass driven by its findings.
1. Performance harness (
perf/)One command produces a side-by-side report flagging every workload where Pluto is slower than Charon (
ratio > 1.15→SUBOPTIMAL):perf/go-benchmodule consuming the vendored charon source viareplacedirectives —charon/stays pristine.bench-utilfeature.create enr/create cluster, peak RSS, timed all-pluto vs all-charon DKG ceremonies throughscripts/dkg-runner.perf/fixtures/, and each Rust bench asserts a round-trip against the fixture before timing.perf.ymlworkflow: nightly + on-demand tiers 1+2, report in the job summary, baseline regression gating (exit 2) once a blessedperf/baseline.jsonis committed.perf/FINDINGS.md(5 root causes, prioritized by duty-hot-path impact).2. Optimization pass (FINDINGS items 1, 2, 4)
Deferred per FINDINGS: QBFT instance lifecycle (needs a design pass) and ceremony-path items (scrypt, k1 sign). Remaining split/recover gap (~2x) is checked per-share validation + HKDF-based coefficient keygen, kept deliberately.
Testing
cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo +nightly fmt --all --checkclean.🤖 Generated with Claude Code