perf(assertion-executor): perf-only hot-path wins and profiling loop#675
Open
perf(assertion-executor): perf-only hot-path wins and profiling loop#675
Conversation
|
Benchmark report is ready.
|
|
Benchmark report is ready.
|
696078b to
f0d5516
Compare
…path Assertions that match no trigger selectors were previously returned from the store read path with an empty selector set, causing unnecessary setup work (persistent account insertion, MultiForkDb creation) in the executor. Changed read_adopter from .map() to .filter_map() so assertions with zero matched selectors are dropped before reaching execution. Tests: assertion_store suite (32/32 pass), full lib suite (210 pass, 1 pre-existing failure from missing test artifact) Bench baseline (before change): assertion_store::read/hit_existing_assertion: 679.68 ns assertion_store::read/miss_nonexistent: 324.00 ns executor_transaction_performance/eoa_transaction_aa: 44.824 µs executor_transaction_performance/erc20_transaction_aa: 67.632 µs executor_transaction_performance/uniswap_transaction_aa: 387.06 µs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit a10e259)
…xecution Both run_assertion_contract and run_assertion_contract_with_inspector now return immediately when fn_selectors is empty, avoiding unnecessary prepare_assertion_contract work (persistent account insertion, MultiForkDb creation, PhEvmInspector cloning). Combined with Phase 1 selector-pruning, this ensures zero-work execution when trigger matching produces no selectors. Tests: executor suite (6/6 pass) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit dac36b2)
Adds a PARALLEL_THRESHOLD constant (currently 2). When the number of assertion contracts or fn_selectors is below this threshold, execution uses sequential iterators instead of rayon's parallel iterators to avoid thread scheduling overhead. This matters because: - Most transactions trigger 0-1 assertion contracts - Most assertion contracts have 1-3 fn_selectors - Rayon fan-out has ~10-20µs scheduling overhead per task The change is behavior-preserving: only scheduling strategy changes. Also re-exports AssertionsForExecution from store module for use in the executor's sequential path closure type annotation. Tests: full lib suite (210 pass, 1 pre-existing failure) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> (cherry picked from commit 1d72940)
6db8e8a to
d99f7d6
Compare
|
Benchmark report is ready.
|
|
Benchmark report is ready.
|
|
Benchmark report is ready.
|
Contributor
Author
|
Updated the PR title/body to make review easier. Suggested review order:
This PR is intentionally perf-only: no new cheatcodes and no new business-logic feature work. |
|
Benchmark report is ready.
|
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
Review Guide
crates/assertion-executor/src/executor/mod.rscrates/assertion-executor/src/executor/with_inspector.rscrates/assertion-executor/src/inspectors/tracer.rscrates/assertion-executor/src/store/assertion_store.rscrates/assertion-executor/src/inspectors/precompiles/legacy/get_logs.rscrates/assertion-executor/src/inspectors/precompiles/legacy/state_changes.rscrates/benchmark-utils/src/perf.rscrates/benchmark-utils/src/bin/benchmark-utils-perf.rscrates/assertion-executor/benches/Makefile.github/workflows/benchmarks.yml.claude/skills/samply-profile/SKILL.mdsamplyentrypointNon-goals
Validation
cargo clippy -p assertion-executor -p benchmark-utils --all-targets --features test -- -D warnings -D clippy::pedanticcargo test -p benchmark-utilscargo test -p assertion-executor --libcargo bench --manifest-path crates/assertion-executor/Cargo.toml --features test --benches --no-runRUSTFLAGS='-C opt-level=1' SIDECAR_BENCH_TRANSPORT=mock RUST_LOG=error cargo bench -p sidecar --features bench-utils --benches --no-runRepresentative Bench Deltas Vs main
assertion_store::read/miss_nonexistent_assertion: about-97.7%call_tracer_truncate/15k_deep_pending: about-19.4%avg_block_100_aa: about-32.5%erc20_transaction: about-65.5%uniswap_transaction_aa: about-28.1%Samply Follow-up
samplyruns viabenchmark-utils-perf