mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: add pprof profiler/flamegraphs to all criterion benchmarks (#1425)
This commit is contained in:
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -4320,6 +4320,7 @@ dependencies = [
|
||||
"parity-scale-codec",
|
||||
"paste",
|
||||
"postcard",
|
||||
"pprof",
|
||||
"proptest",
|
||||
"proptest-derive",
|
||||
"rand 0.8.5",
|
||||
@ -4552,6 +4553,7 @@ dependencies = [
|
||||
"libc",
|
||||
"lifetimed-bytes",
|
||||
"parking_lot 0.12.1",
|
||||
"pprof",
|
||||
"rand 0.8.5",
|
||||
"rand_xorshift",
|
||||
"reth-mdbx-sys",
|
||||
@ -4696,6 +4698,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"parity-scale-codec",
|
||||
"plain_hasher",
|
||||
"pprof",
|
||||
"proptest",
|
||||
"proptest-derive",
|
||||
"rand 0.8.5",
|
||||
@ -4756,6 +4759,7 @@ dependencies = [
|
||||
"ethereum-types",
|
||||
"ethnum",
|
||||
"hex-literal",
|
||||
"pprof",
|
||||
"rand 0.8.5",
|
||||
"reth-rlp",
|
||||
"reth-rlp-derive",
|
||||
|
||||
@ -80,6 +80,7 @@ proptest-derive = "0.3"
|
||||
# https://github.com/paradigmxyz/reth/pull/177#discussion_r1021172198
|
||||
secp256k1 = "0.24.2"
|
||||
criterion = "0.4.0"
|
||||
pprof = { version = "0.11", features = ["flamegraph", "frame-pointer", "criterion"] }
|
||||
|
||||
[features]
|
||||
default = []
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use hex_literal::hex;
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_primitives::TransactionSigned;
|
||||
use reth_rlp::Decodable;
|
||||
|
||||
@ -16,5 +17,9 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
|
||||
targets = criterion_benchmark
|
||||
}
|
||||
criterion_main!(benches);
|
||||
|
||||
@ -33,6 +33,7 @@ rand = "0.8"
|
||||
secp256k1 = { version = "0.24", features = [
|
||||
"rand-std",
|
||||
] }
|
||||
pprof = { version = "0.11", features = ["flamegraph", "frame-pointer", "criterion"] }
|
||||
|
||||
[features]
|
||||
alloc = []
|
||||
|
||||
@ -12,6 +12,7 @@ use bytes::BytesMut;
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use ethnum::*;
|
||||
use hex_literal::hex;
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_rlp::*;
|
||||
|
||||
fn bench_encode(c: &mut Criterion) {
|
||||
@ -65,5 +66,9 @@ fn bench_decode(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_encode, bench_decode);
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
|
||||
targets = bench_encode, bench_decode
|
||||
}
|
||||
criterion_main!(benches);
|
||||
|
||||
@ -52,6 +52,7 @@ reth-interfaces = { path = "../../interfaces", features = ["bench"] }
|
||||
tempfile = "3.3.0"
|
||||
test-fuzz = "3.0.4"
|
||||
|
||||
pprof = { version = "0.11", features = ["flamegraph", "frame-pointer", "criterion"] }
|
||||
criterion = "0.4.0"
|
||||
iai = "0.1.1"
|
||||
tokio = { version = "1.21.2", features = ["full"] }
|
||||
|
||||
@ -3,10 +3,15 @@
|
||||
use criterion::{
|
||||
black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
|
||||
};
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_db::cursor::{DbDupCursorRO, DbDupCursorRW};
|
||||
use std::time::Instant;
|
||||
|
||||
criterion_group!(benches, db, serialization);
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
|
||||
targets = db, serialization
|
||||
}
|
||||
criterion_main!(benches);
|
||||
|
||||
pub fn db(c: &mut Criterion) {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
use criterion::{
|
||||
black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
|
||||
};
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use proptest::{
|
||||
arbitrary::Arbitrary,
|
||||
prelude::{any_with, ProptestConfig},
|
||||
@ -16,7 +17,11 @@ use reth_db::{
|
||||
use std::{collections::HashSet, time::Instant};
|
||||
use test_fuzz::runtime::num_traits::Zero;
|
||||
|
||||
criterion_group!(benches, hash_keys);
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
|
||||
targets = hash_keys
|
||||
}
|
||||
criterion_main!(benches);
|
||||
|
||||
/// It benchmarks the insertion of rows into a table where `Keys` are hashes.
|
||||
|
||||
@ -24,6 +24,7 @@ ffi = { package = "reth-mdbx-sys", path = "./mdbx-sys" }
|
||||
lifetimed-bytes = { version = "0.1", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
pprof = { version = "0.11", features = ["flamegraph", "frame-pointer", "criterion"] }
|
||||
criterion = "0.4"
|
||||
rand = "0.8"
|
||||
rand_xorshift = "0.3"
|
||||
|
||||
@ -2,6 +2,7 @@ mod utils;
|
||||
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use ffi::*;
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use reth_libmdbx::*;
|
||||
use std::ptr;
|
||||
use utils::*;
|
||||
@ -101,5 +102,9 @@ fn bench_get_seq_raw(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_get_seq_iter, bench_get_seq_cursor, bench_get_seq_raw);
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
|
||||
targets = bench_get_seq_iter, bench_get_seq_cursor, bench_get_seq_raw
|
||||
}
|
||||
criterion_main!(benches);
|
||||
|
||||
@ -115,5 +115,9 @@ fn bench_put_rand_raw(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_get_rand, bench_get_rand_raw, bench_put_rand, bench_put_rand_raw);
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default().with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
|
||||
targets = bench_get_rand, bench_get_rand_raw, bench_put_rand, bench_put_rand_raw
|
||||
}
|
||||
criterion_main!(benches);
|
||||
|
||||
Reference in New Issue
Block a user