fix(lint): lint warnings for db benchmark tools (#11011)

This commit is contained in:
Emilia Hane
2024-09-19 13:32:07 +02:00
committed by GitHub
parent f9abc8a35c
commit 5f022e1cd1
3 changed files with 33 additions and 14 deletions

View File

@ -1,14 +1,22 @@
#![allow(missing_docs)] #![allow(missing_docs)]
use std::{path::Path, sync::Arc};
use criterion::{ use criterion::{
black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
}; };
use pprof::criterion::{Output, PProfProfiler}; use pprof::criterion::{Output, PProfProfiler};
use reth_db::tables::*; use reth_db::{tables::*, test_utils::create_test_rw_db_with_path};
use reth_db_api::{ use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW}, cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO, DbDupCursorRW},
table::{Decode, Decompress, DupSort}, database::Database,
transaction::DbTx, table::{Compress, Decode, Decompress, DupSort, Encode, Table},
transaction::{DbTx, DbTxMut},
}; };
use reth_fs_util as fs;
mod utils;
use utils::*;
criterion_group! { criterion_group! {
name = benches; name = benches;
@ -291,5 +299,3 @@ where
// group.bench_function(format!("{}.RandomRead", T::NAME), |b| {}); // group.bench_function(format!("{}.RandomRead", T::NAME), |b| {});
} }
include!("./utils.rs");

View File

@ -1,4 +1,7 @@
#![allow(missing_docs)] #![allow(missing_docs)]
use std::{collections::HashSet, path::Path, sync::Arc};
use criterion::{ use criterion::{
black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion, black_box, criterion_group, criterion_main, measurement::WallTime, BenchmarkGroup, Criterion,
}; };
@ -9,9 +12,17 @@ use proptest::{
strategy::{Strategy, ValueTree}, strategy::{Strategy, ValueTree},
test_runner::TestRunner, test_runner::TestRunner,
}; };
use reth_db::TransactionHashNumbers; use reth_db::{test_utils::create_test_rw_db_with_path, DatabaseEnv, TransactionHashNumbers};
use reth_db_api::cursor::DbCursorRW; use reth_db_api::{
use std::collections::HashSet; cursor::DbCursorRW,
database::Database,
table::{Table, TableRow},
transaction::DbTxMut,
};
use reth_fs_util as fs;
mod utils;
use utils::*;
criterion_group! { criterion_group! {
name = benches; name = benches;
@ -252,5 +263,3 @@ where
}) })
.unwrap(); .unwrap();
} }
include!("./utils.rs");

View File

@ -1,20 +1,24 @@
#![cfg(feature = "test-utils")]
#![allow(missing_docs)]
use std::{path::Path, sync::Arc};
use alloy_primitives::Bytes; use alloy_primitives::Bytes;
use reth_db::{test_utils::create_test_rw_db_with_path, DatabaseEnv}; use reth_db::{test_utils::create_test_rw_db_with_path, DatabaseEnv};
use reth_db_api::{ use reth_db_api::{
database::Database,
table::{Compress, Encode, Table, TableRow}, table::{Compress, Encode, Table, TableRow},
transaction::DbTxMut, transaction::DbTxMut,
Database,
}; };
use reth_fs_util as fs; use reth_fs_util as fs;
use std::{path::Path, sync::Arc};
/// Path where the DB is initialized for benchmarks. /// Path where the DB is initialized for benchmarks.
#[allow(dead_code)] #[allow(dead_code)]
const BENCH_DB_PATH: &str = "/tmp/reth-benches"; pub(crate) const BENCH_DB_PATH: &str = "/tmp/reth-benches";
/// Used for `RandomRead` and `RandomWrite` benchmarks. /// Used for `RandomRead` and `RandomWrite` benchmarks.
#[allow(dead_code)] #[allow(dead_code)]
const RANDOM_INDEXES: [usize; 10] = [23, 2, 42, 5, 3, 99, 54, 0, 33, 64]; pub(crate) const RANDOM_INDEXES: [usize; 10] = [23, 2, 42, 5, 3, 99, 54, 0, 33, 64];
/// Returns bench vectors in the format: `Vec<(Key, EncodedKey, Value, CompressedValue)>`. /// Returns bench vectors in the format: `Vec<(Key, EncodedKey, Value, CompressedValue)>`.
#[allow(dead_code)] #[allow(dead_code)]