Skip to content

Commit

Permalink
Adding spans to differentiate caching and benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Aug 12, 2024
1 parent 2f5f56e commit 4f55cb4
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions replay/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,29 @@ fn main() {
let block_end = BlockNumber(block_end);
let chain = parse_network(&chain);

info!("fetching block range data");
let mut block_range_data = fetch_block_range_data(block_start, block_end, chain);
let mut block_range_data = {
let _caching_span = info_span!("caching block range").entered();

// We must execute the block range once first to ensure that all data required by blockifier is chached
info!("filling up execution cache");
execute_block_range(&mut block_range_data);
info!("fetching block range data");
let mut block_range_data = fetch_block_range_data(block_start, block_end, chain);

// Benchmark run should make no api requests as all data is cached
// To ensure this, we disable the inner StateReader
for (cached_state, ..) in &mut block_range_data {
cached_state.state.disable();
}
// We must execute the block range once first to ensure that all data required by blockifier is chached
info!("filling up execution cache");
execute_block_range(&mut block_range_data);

// Benchmark run should make no api requests as all data is cached
// To ensure this, we disable the inner StateReader
for (cached_state, ..) in &mut block_range_data {
cached_state.state.disable();
}

block_range_data
};

{
let _benchmark_span = info_span!("benchmarking block range").entered();
let before_execution = Instant::now();

info!("replaying with cached state");

for _ in 0..number_of_runs {
execute_block_range(&mut block_range_data);
}
Expand Down

0 comments on commit 4f55cb4

Please sign in to comment.