-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(katana): optimisations + benchmark setup #2900
base: main
Are you sure you want to change the base?
Conversation
e2dacee
to
5519e6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This benchmark includes data setup within the measured function (ie Uncommitted::commit
). We should move the preparation of the test data (all the arguments for Uncommitted::new
) outside the benchmark routine to ensure we're measuring only the commit operation's performance, not including the setup overhead.
We can use the Arbitrary
trait to derive random values for the test data.
I'm not sure what's the best block composition but maybe we can start with something like 20 transactions, each with 2 events, and a state update of size 100.
I think what we should do, is have two |
5519e6b
to
3728e6d
Compare
Hi @kariy ! So, I've kept 2 versions of optimized functions (original + I used Maybe it would be a good idea to have 2 sets of data for these benches:
WDYT ? |
3728e6d
to
e9aaea6
Compare
e9aaea6
to
347b9b0
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2900 +/- ##
==========================================
- Coverage 55.86% 55.79% -0.07%
==========================================
Files 447 447
Lines 57859 57924 +65
==========================================
- Hits 32323 32319 -4
- Misses 25536 25605 +69 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @remybar! It's looking good. Can we also include benchmark for block with only 1 tx and very small state updates - to mimic a small block (eg on instant mining when there's only 1 tx in a block)
}); | ||
} | ||
|
||
criterion_group!(benches, commit_benchmark); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
criterion_group!(benches, commit_benchmark); | |
criterion_group! { | |
name = benches; | |
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None))); | |
targets = commit_benchmark | |
} |
let block = | ||
UncommittedBlock::new(header, transactions, receipts.as_slice(), &state_updates, provider); | ||
|
||
c.bench_function("commit", |b| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
c.bench_function("commit", |b| { | |
c.bench_function("Commit.Big.Serial", |b| { |
b.iter_batched(|| block.clone(), |input| commit(black_box(input)), BatchSize::SmallInput); | ||
}); | ||
|
||
c.bench_function("commit_parallel", |b| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
c.bench_function("commit_parallel", |b| { | |
c.bench_function("Commit.Big.Parallel", |b| { |
Description
WIP
Related issue
#2719
Tests
Added to documentation?
Checklist
scripts/prettier.sh
,scripts/rust_fmt.sh
,scripts/cairo_fmt.sh
)scripts/clippy.sh
,scripts/docs.sh
)