Skip to content

Commit

Permalink
chore: rm async from state root from bench (paradigmxyz#13472)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 20, 2024
1 parent 378d80a commit 30e8c78
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions crates/trie/parallel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,8 @@ reth-trie = { workspace = true, features = ["test-utils"] }

# misc
rand.workspace = true
tokio = { workspace = true, default-features = false, features = [
"sync",
"rt",
"macros",
] }
rayon.workspace = true
criterion = { workspace = true, features = ["async_tokio"] }
criterion.workspace = true
proptest.workspace = true
proptest-arbitrary-interop.workspace = true

Expand Down
10 changes: 4 additions & 6 deletions crates/trie/parallel/benches/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ pub fn calculate_state_root(c: &mut Criterion) {
let mut group = c.benchmark_group("Calculate State Root");
group.sample_size(20);

let runtime = tokio::runtime::Runtime::new().unwrap();

for size in [1_000, 3_000, 5_000, 10_000] {
let (db_state, updated_state) = generate_test_data(size);
let provider_factory = create_test_provider_factory();
Expand All @@ -37,14 +35,14 @@ pub fn calculate_state_root(c: &mut Criterion) {

// state root
group.bench_function(BenchmarkId::new("sync root", size), |b| {
b.to_async(&runtime).iter_with_setup(
b.iter_with_setup(
|| {
let sorted_state = updated_state.clone().into_sorted();
let prefix_sets = updated_state.construct_prefix_sets().freeze();
let provider = provider_factory.provider().unwrap();
(provider, sorted_state, prefix_sets)
},
|(provider, sorted_state, prefix_sets)| async move {
|(provider, sorted_state, prefix_sets)| {
let hashed_cursor_factory = HashedPostStateCursorFactory::new(
DatabaseHashedCursorFactory::new(provider.tx_ref()),
&sorted_state,
Expand All @@ -59,14 +57,14 @@ pub fn calculate_state_root(c: &mut Criterion) {

// parallel root
group.bench_function(BenchmarkId::new("parallel root", size), |b| {
b.to_async(&runtime).iter_with_setup(
b.iter_with_setup(
|| {
ParallelStateRoot::new(
view.clone(),
TrieInput::from_state(updated_state.clone()),
)
},
|calculator| async { calculator.incremental_root() },
|calculator| calculator.incremental_root(),
);
});
}
Expand Down
4 changes: 2 additions & 2 deletions crates/trie/parallel/src/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ mod tests {
use reth_provider::{test_utils::create_test_provider_factory, HashingWriter};
use reth_trie::{test_utils, HashedPostState, HashedStorage};

#[tokio::test]
async fn random_parallel_root() {
#[test]
fn random_parallel_root() {
let factory = create_test_provider_factory();
let consistent_view = ConsistentDbView::new(factory.clone(), None);

Expand Down

0 comments on commit 30e8c78

Please sign in to comment.