From 9ba3e929e5faed62a63f83c4b04c882af03e52c3 Mon Sep 17 00:00:00 2001 From: Eagle941 <8973725+Eagle941@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:46:05 +0100 Subject: [PATCH] chore: merged benchmarks --- crates/blockifier/bench/blockifier_bench.rs | 48 +++++++++++---------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/crates/blockifier/bench/blockifier_bench.rs b/crates/blockifier/bench/blockifier_bench.rs index 3bb82c098b..661ebde569 100644 --- a/crates/blockifier/bench/blockifier_bench.rs +++ b/crates/blockifier/bench/blockifier_bench.rs @@ -21,6 +21,7 @@ use blockifier::context::BlockContext; use blockifier::invoke_tx_args; use blockifier::state::cached_state::{CachedState, TransactionalState}; use blockifier::state::state_api::State; +use blockifier::state::visited_pcs::VisitedPcsSet; use blockifier::test_utils::contracts::FeatureContract; use blockifier::test_utils::dict_state_reader::DictStateReader; use blockifier::test_utils::initial_test_state::test_state; @@ -65,7 +66,7 @@ pub fn cached_state_benchmark(c: &mut Criterion) { } // The state shared across all iterations. - let mut cached_state: CachedState = CachedState::default(); + let mut cached_state: CachedState = CachedState::default(); c.bench_function("cached_state", move |benchmark| { benchmark.iter_batched( @@ -81,107 +82,107 @@ pub fn cached_state_benchmark(c: &mut Criterion) { let mut random_arrays = Vec::new(); let class_hash = create_class_hash("a"); - let random_array = get_random_array(11393).into_iter().collect(); + let random_array: Vec = get_random_array(11393).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("a"); - let random_array = get_random_array(453).into_iter().collect(); + let random_array: Vec = get_random_array(453).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("a"); - let random_array = get_random_array(604).into_iter().collect(); + let random_array: Vec = get_random_array(604).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("a"); - let random_array = get_random_array(806).into_iter().collect(); + let random_array: Vec = get_random_array(806).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("b"); - let random_array = get_random_array(1327).into_iter().collect(); + let random_array: Vec = get_random_array(1327).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("b"); - let random_array = get_random_array(1135).into_iter().collect(); + let random_array: Vec = get_random_array(1135).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("b"); - let random_array = get_random_array(213).into_iter().collect(); + let random_array: Vec = get_random_array(213).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("b"); - let random_array = get_random_array(135).into_iter().collect(); + let random_array: Vec = get_random_array(135).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("c"); - let random_array = get_random_array(348).into_iter().collect(); + let random_array: Vec = get_random_array(348).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("c"); - let random_array = get_random_array(88).into_iter().collect(); + let random_array: Vec = get_random_array(88).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("c"); - let random_array = get_random_array(348).into_iter().collect(); + let random_array: Vec = get_random_array(348).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("c"); - let random_array = get_random_array(348).into_iter().collect(); + let random_array: Vec = get_random_array(348).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("d"); - let random_array = get_random_array(875).into_iter().collect(); + let random_array: Vec = get_random_array(875).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("d"); - let random_array = get_random_array(450).into_iter().collect(); + let random_array: Vec = get_random_array(450).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("d"); - let random_array = get_random_array(255).into_iter().collect(); + let random_array: Vec = get_random_array(255).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("d"); - let random_array = get_random_array(210).into_iter().collect(); + let random_array: Vec = get_random_array(210).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("d"); - let random_array = get_random_array(1403).into_iter().collect(); + let random_array: Vec = get_random_array(1403).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("d"); - let random_array = get_random_array(210).into_iter().collect(); + let random_array: Vec = get_random_array(210).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("d"); - let random_array = get_random_array(210).into_iter().collect(); + let random_array: Vec = get_random_array(210).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("e"); - let random_array = get_random_array(2386).into_iter().collect(); + let random_array: Vec = get_random_array(2386).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); let class_hash = create_class_hash("e"); - let random_array = get_random_array(3602).into_iter().collect(); + let random_array: Vec = get_random_array(3602).into_iter().collect(); class_hashes.push(class_hash); random_arrays.push(random_array); @@ -202,7 +203,8 @@ pub fn cached_state_benchmark(c: &mut Criterion) { pub fn execution_benchmark(c: &mut Criterion) { /// This function sets up and returns all the objects required to execute an invoke transaction. - fn prepare_account_tx() -> (AccountTransaction, CachedState, BlockContext) { + fn prepare_account_tx() + -> (AccountTransaction, CachedState, BlockContext) { let block_context = block_context(); let max_resource_bounds = max_resource_bounds(); let cairo_version = CairoVersion::Cairo1;