Skip to content

Commit 441544a

Browse files
committed
chore: merged benchmarks
1 parent 9c8e115 commit 441544a

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
@@ -21,6 +21,7 @@ use blockifier::context::BlockContext;
2121
use blockifier::invoke_tx_args;
2222
use blockifier::state::cached_state::{CachedState, TransactionalState};
2323
use blockifier::state::state_api::State;
24+
use blockifier::state::visited_pcs::VisitedPcsSet;
2425
use blockifier::test_utils::contracts::FeatureContract;
2526
use blockifier::test_utils::dict_state_reader::DictStateReader;
2627
use blockifier::test_utils::initial_test_state::test_state;
@@ -65,7 +66,7 @@ pub fn cached_state_benchmark(c: &mut Criterion) {
6566
}
6667

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

7071
c.bench_function("cached_state", move |benchmark| {
7172
benchmark.iter_batched(
@@ -81,107 +82,107 @@ pub fn cached_state_benchmark(c: &mut Criterion) {
8182
let mut random_arrays = Vec::new();
8283

8384
let class_hash = create_class_hash("a");
84-
let random_array = get_random_array(11393).into_iter().collect();
85+
let random_array: Vec<usize> = get_random_array(11393).into_iter().collect();
8586
class_hashes.push(class_hash);
8687
random_arrays.push(random_array);
8788

8889
let class_hash = create_class_hash("a");
89-
let random_array = get_random_array(453).into_iter().collect();
90+
let random_array: Vec<usize> = get_random_array(453).into_iter().collect();
9091
class_hashes.push(class_hash);
9192
random_arrays.push(random_array);
9293

9394
let class_hash = create_class_hash("a");
94-
let random_array = get_random_array(604).into_iter().collect();
95+
let random_array: Vec<usize> = get_random_array(604).into_iter().collect();
9596
class_hashes.push(class_hash);
9697
random_arrays.push(random_array);
9798

9899
let class_hash = create_class_hash("a");
99-
let random_array = get_random_array(806).into_iter().collect();
100+
let random_array: Vec<usize> = get_random_array(806).into_iter().collect();
100101
class_hashes.push(class_hash);
101102
random_arrays.push(random_array);
102103

103104
let class_hash = create_class_hash("b");
104-
let random_array = get_random_array(1327).into_iter().collect();
105+
let random_array: Vec<usize> = get_random_array(1327).into_iter().collect();
105106
class_hashes.push(class_hash);
106107
random_arrays.push(random_array);
107108

108109
let class_hash = create_class_hash("b");
109-
let random_array = get_random_array(1135).into_iter().collect();
110+
let random_array: Vec<usize> = get_random_array(1135).into_iter().collect();
110111
class_hashes.push(class_hash);
111112
random_arrays.push(random_array);
112113

113114
let class_hash = create_class_hash("b");
114-
let random_array = get_random_array(213).into_iter().collect();
115+
let random_array: Vec<usize> = get_random_array(213).into_iter().collect();
115116
class_hashes.push(class_hash);
116117
random_arrays.push(random_array);
117118

118119
let class_hash = create_class_hash("b");
119-
let random_array = get_random_array(135).into_iter().collect();
120+
let random_array: Vec<usize> = get_random_array(135).into_iter().collect();
120121
class_hashes.push(class_hash);
121122
random_arrays.push(random_array);
122123

123124
let class_hash = create_class_hash("c");
124-
let random_array = get_random_array(348).into_iter().collect();
125+
let random_array: Vec<usize> = get_random_array(348).into_iter().collect();
125126
class_hashes.push(class_hash);
126127
random_arrays.push(random_array);
127128

128129
let class_hash = create_class_hash("c");
129-
let random_array = get_random_array(88).into_iter().collect();
130+
let random_array: Vec<usize> = get_random_array(88).into_iter().collect();
130131
class_hashes.push(class_hash);
131132
random_arrays.push(random_array);
132133

133134
let class_hash = create_class_hash("c");
134-
let random_array = get_random_array(348).into_iter().collect();
135+
let random_array: Vec<usize> = get_random_array(348).into_iter().collect();
135136
class_hashes.push(class_hash);
136137
random_arrays.push(random_array);
137138

138139
let class_hash = create_class_hash("c");
139-
let random_array = get_random_array(348).into_iter().collect();
140+
let random_array: Vec<usize> = get_random_array(348).into_iter().collect();
140141
class_hashes.push(class_hash);
141142
random_arrays.push(random_array);
142143

143144
let class_hash = create_class_hash("d");
144-
let random_array = get_random_array(875).into_iter().collect();
145+
let random_array: Vec<usize> = get_random_array(875).into_iter().collect();
145146
class_hashes.push(class_hash);
146147
random_arrays.push(random_array);
147148

148149
let class_hash = create_class_hash("d");
149-
let random_array = get_random_array(450).into_iter().collect();
150+
let random_array: Vec<usize> = get_random_array(450).into_iter().collect();
150151
class_hashes.push(class_hash);
151152
random_arrays.push(random_array);
152153

153154
let class_hash = create_class_hash("d");
154-
let random_array = get_random_array(255).into_iter().collect();
155+
let random_array: Vec<usize> = get_random_array(255).into_iter().collect();
155156
class_hashes.push(class_hash);
156157
random_arrays.push(random_array);
157158

158159
let class_hash = create_class_hash("d");
159-
let random_array = get_random_array(210).into_iter().collect();
160+
let random_array: Vec<usize> = get_random_array(210).into_iter().collect();
160161
class_hashes.push(class_hash);
161162
random_arrays.push(random_array);
162163

163164
let class_hash = create_class_hash("d");
164-
let random_array = get_random_array(1403).into_iter().collect();
165+
let random_array: Vec<usize> = get_random_array(1403).into_iter().collect();
165166
class_hashes.push(class_hash);
166167
random_arrays.push(random_array);
167168

168169
let class_hash = create_class_hash("d");
169-
let random_array = get_random_array(210).into_iter().collect();
170+
let random_array: Vec<usize> = get_random_array(210).into_iter().collect();
170171
class_hashes.push(class_hash);
171172
random_arrays.push(random_array);
172173

173174
let class_hash = create_class_hash("d");
174-
let random_array = get_random_array(210).into_iter().collect();
175+
let random_array: Vec<usize> = get_random_array(210).into_iter().collect();
175176
class_hashes.push(class_hash);
176177
random_arrays.push(random_array);
177178

178179
let class_hash = create_class_hash("e");
179-
let random_array = get_random_array(2386).into_iter().collect();
180+
let random_array: Vec<usize> = get_random_array(2386).into_iter().collect();
180181
class_hashes.push(class_hash);
181182
random_arrays.push(random_array);
182183

183184
let class_hash = create_class_hash("e");
184-
let random_array = get_random_array(3602).into_iter().collect();
185+
let random_array: Vec<usize> = get_random_array(3602).into_iter().collect();
185186
class_hashes.push(class_hash);
186187
random_arrays.push(random_array);
187188

@@ -202,7 +203,8 @@ pub fn cached_state_benchmark(c: &mut Criterion) {
202203

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

0 commit comments

Comments
 (0)