Skip to content

Commit 23d8fbc

Browse files
committed
chore: merged benchmarks
1 parent eb5195c commit 23d8fbc

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

crates/blockifier/bench/blockifier_bench.rs

+25-23
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use blockifier::context::BlockContext;
1919
use blockifier::invoke_tx_args;
2020
use blockifier::state::cached_state::{CachedState, TransactionalState};
2121
use blockifier::state::state_api::State;
22+
use blockifier::state::visited_pcs::VisitedPcsSet;
2223
use blockifier::test_utils::contracts::FeatureContract;
2324
use blockifier::test_utils::dict_state_reader::DictStateReader;
2425
use blockifier::test_utils::initial_test_state::test_state;
@@ -63,7 +64,7 @@ pub fn cached_state_benchmark(c: &mut Criterion) {
6364
}
6465

6566
// The state shared across all iterations.
66-
let mut cached_state: CachedState<DictStateReader> = CachedState::default();
67+
let mut cached_state: CachedState<DictStateReader, VisitedPcsSet> = CachedState::default();
6768

6869
c.bench_function("cached_state", move |benchmark| {
6970
benchmark.iter_batched(
@@ -79,107 +80,107 @@ pub fn cached_state_benchmark(c: &mut Criterion) {
7980
let mut random_arrays = Vec::new();
8081

8182
let class_hash = create_class_hash("a");
82-
let random_array = get_random_array(11393).into_iter().collect();
83+
let random_array: Vec<usize> = get_random_array(11393).into_iter().collect();
8384
class_hashes.push(class_hash);
8485
random_arrays.push(random_array);
8586

8687
let class_hash = create_class_hash("a");
87-
let random_array = get_random_array(453).into_iter().collect();
88+
let random_array: Vec<usize> = get_random_array(453).into_iter().collect();
8889
class_hashes.push(class_hash);
8990
random_arrays.push(random_array);
9091

9192
let class_hash = create_class_hash("a");
92-
let random_array = get_random_array(604).into_iter().collect();
93+
let random_array: Vec<usize> = get_random_array(604).into_iter().collect();
9394
class_hashes.push(class_hash);
9495
random_arrays.push(random_array);
9596

9697
let class_hash = create_class_hash("a");
97-
let random_array = get_random_array(806).into_iter().collect();
98+
let random_array: Vec<usize> = get_random_array(806).into_iter().collect();
9899
class_hashes.push(class_hash);
99100
random_arrays.push(random_array);
100101

101102
let class_hash = create_class_hash("b");
102-
let random_array = get_random_array(1327).into_iter().collect();
103+
let random_array: Vec<usize> = get_random_array(1327).into_iter().collect();
103104
class_hashes.push(class_hash);
104105
random_arrays.push(random_array);
105106

106107
let class_hash = create_class_hash("b");
107-
let random_array = get_random_array(1135).into_iter().collect();
108+
let random_array: Vec<usize> = get_random_array(1135).into_iter().collect();
108109
class_hashes.push(class_hash);
109110
random_arrays.push(random_array);
110111

111112
let class_hash = create_class_hash("b");
112-
let random_array = get_random_array(213).into_iter().collect();
113+
let random_array: Vec<usize> = get_random_array(213).into_iter().collect();
113114
class_hashes.push(class_hash);
114115
random_arrays.push(random_array);
115116

116117
let class_hash = create_class_hash("b");
117-
let random_array = get_random_array(135).into_iter().collect();
118+
let random_array: Vec<usize> = get_random_array(135).into_iter().collect();
118119
class_hashes.push(class_hash);
119120
random_arrays.push(random_array);
120121

121122
let class_hash = create_class_hash("c");
122-
let random_array = get_random_array(348).into_iter().collect();
123+
let random_array: Vec<usize> = get_random_array(348).into_iter().collect();
123124
class_hashes.push(class_hash);
124125
random_arrays.push(random_array);
125126

126127
let class_hash = create_class_hash("c");
127-
let random_array = get_random_array(88).into_iter().collect();
128+
let random_array: Vec<usize> = get_random_array(88).into_iter().collect();
128129
class_hashes.push(class_hash);
129130
random_arrays.push(random_array);
130131

131132
let class_hash = create_class_hash("c");
132-
let random_array = get_random_array(348).into_iter().collect();
133+
let random_array: Vec<usize> = get_random_array(348).into_iter().collect();
133134
class_hashes.push(class_hash);
134135
random_arrays.push(random_array);
135136

136137
let class_hash = create_class_hash("c");
137-
let random_array = get_random_array(348).into_iter().collect();
138+
let random_array: Vec<usize> = get_random_array(348).into_iter().collect();
138139
class_hashes.push(class_hash);
139140
random_arrays.push(random_array);
140141

141142
let class_hash = create_class_hash("d");
142-
let random_array = get_random_array(875).into_iter().collect();
143+
let random_array: Vec<usize> = get_random_array(875).into_iter().collect();
143144
class_hashes.push(class_hash);
144145
random_arrays.push(random_array);
145146

146147
let class_hash = create_class_hash("d");
147-
let random_array = get_random_array(450).into_iter().collect();
148+
let random_array: Vec<usize> = get_random_array(450).into_iter().collect();
148149
class_hashes.push(class_hash);
149150
random_arrays.push(random_array);
150151

151152
let class_hash = create_class_hash("d");
152-
let random_array = get_random_array(255).into_iter().collect();
153+
let random_array: Vec<usize> = get_random_array(255).into_iter().collect();
153154
class_hashes.push(class_hash);
154155
random_arrays.push(random_array);
155156

156157
let class_hash = create_class_hash("d");
157-
let random_array = get_random_array(210).into_iter().collect();
158+
let random_array: Vec<usize> = get_random_array(210).into_iter().collect();
158159
class_hashes.push(class_hash);
159160
random_arrays.push(random_array);
160161

161162
let class_hash = create_class_hash("d");
162-
let random_array = get_random_array(1403).into_iter().collect();
163+
let random_array: Vec<usize> = get_random_array(1403).into_iter().collect();
163164
class_hashes.push(class_hash);
164165
random_arrays.push(random_array);
165166

166167
let class_hash = create_class_hash("d");
167-
let random_array = get_random_array(210).into_iter().collect();
168+
let random_array: Vec<usize> = get_random_array(210).into_iter().collect();
168169
class_hashes.push(class_hash);
169170
random_arrays.push(random_array);
170171

171172
let class_hash = create_class_hash("d");
172-
let random_array = get_random_array(210).into_iter().collect();
173+
let random_array: Vec<usize> = get_random_array(210).into_iter().collect();
173174
class_hashes.push(class_hash);
174175
random_arrays.push(random_array);
175176

176177
let class_hash = create_class_hash("e");
177-
let random_array = get_random_array(2386).into_iter().collect();
178+
let random_array: Vec<usize> = get_random_array(2386).into_iter().collect();
178179
class_hashes.push(class_hash);
179180
random_arrays.push(random_array);
180181

181182
let class_hash = create_class_hash("e");
182-
let random_array = get_random_array(3602).into_iter().collect();
183+
let random_array: Vec<usize> = get_random_array(3602).into_iter().collect();
183184
class_hashes.push(class_hash);
184185
random_arrays.push(random_array);
185186

@@ -200,7 +201,8 @@ pub fn cached_state_benchmark(c: &mut Criterion) {
200201

201202
pub fn execution_benchmark(c: &mut Criterion) {
202203
/// This function sets up and returns all the objects required to execute an invoke transaction.
203-
fn prepare_account_tx() -> (AccountTransaction, CachedState<DictStateReader>, BlockContext) {
204+
fn prepare_account_tx()
205+
-> (AccountTransaction, CachedState<DictStateReader, VisitedPcsSet>, BlockContext) {
204206
let block_context = block_context();
205207
let max_resource_bounds = max_resource_bounds();
206208
let cairo_version = CairoVersion::Cairo1;

0 commit comments

Comments
 (0)