chore(l1): add rlp encode benches #5413
Conversation
Lines of code reportTotal lines added: Detailed view |
RLP Bench ResultsBench output |
|
|
||
| - name: Run bench main | ||
| continue-on-error: true | ||
| run: make bench-rlp |
There was a problem hiding this comment.
The benchmark comparison won't work as-is. Two problems:
cargo bench(viamake bench-rlp) without--save-baselinewrites to the default criterion baseline. The second run on the PR branch overwrites the first run's results, so there's nothing to compare.critcmp --list(line 50) only lists the names of saved baselines — it doesn't produce a comparison table.
Fix: save each run to a named baseline and compare them:
- name: Run bench main
continue-on-error: true
run: cd ./crates/common/rlp && cargo bench -- --save-baseline main
# ... checkout PR ...
- name: Run bench PR
run: cd ./crates/common/rlp && cargo bench -- --save-baseline pr
- name: Save comparison
run: |
{
printf '## RLP Bench Results\n\n```\n'
critcmp main pr
printf '\n```\n'
} > result.md|
|
||
| [dev-dependencies] | ||
| hex-literal.workspace = true | ||
| ethrex-p2p.workspace = true |
There was a problem hiding this comment.
The benchmarks live in ethrex-rlp (crates/common/rlp/), not in ethrex-common. This dev-dependency seems unnecessary here and creates a circular dev-dependency (ethrex-common ← ethrex-p2p → ethrex-common). While Cargo allows circular dev-deps, it adds compilation overhead without benefit. Consider removing this and keeping the ethrex-p2p dev-dep only in crates/common/rlp/Cargo.toml where the benches actually are.
| fn bench_encode_blobs_bundle(c: &mut Criterion) { | ||
| let mut group = c.benchmark_group("common_types"); | ||
|
|
||
| let blobs_bundle = black_box(BlobsBundle { |
There was a problem hiding this comment.
nit: This BlobsBundle has 4 blobs but only 1 commitment and 1 proof. In practice these counts must always match (one commitment + one proof per blob). Might want to use matching counts so the benchmark encodes a realistic structure:
blobs: vec![[6u8; BYTES_PER_BLOB]; 4],
commitments: vec![[0x78u8; 48]; 4],
proofs: vec![[0x78u8; 48]; 4],
Adds the encoding benches for rlp
Part of #5411