Skip to content

Commit

Permalink
Move time measure to inside of the match
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Dec 11, 2024
1 parent 2ad9eca commit 5f91e8e
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions crates/blockifier/src/execution/execution_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,28 @@ pub fn execute_entry_point_call(
state: &mut dyn State,
context: &mut EntryPointExecutionContext,
) -> EntryPointExecutionResult<CallInfo> {
let pre_time = std::time::Instant::now();

let mut result = match compiled_class {
match compiled_class {
RunnableCompiledClass::V0(compiled_class) => {
deprecated_entry_point_execution::execute_entry_point_call(
let pre_time = std::time::Instant::now();
let mut result = deprecated_entry_point_execution::execute_entry_point_call(
call,
compiled_class,
state,
context,
)?
)?;
result.time = pre_time.elapsed();
Ok(result)
}
RunnableCompiledClass::V1(compiled_class) => {
entry_point_execution::execute_entry_point_call(call, compiled_class, state, context)?
let pre_time = std::time::Instant::now();
let mut result = entry_point_execution::execute_entry_point_call(
call,
compiled_class,
state,
context,
)?;
result.time = pre_time.elapsed();
Ok(result)
}
#[cfg(feature = "cairo_native")]
RunnableCompiledClass::V1Native(compiled_class) => {
Expand All @@ -150,19 +159,18 @@ pub fn execute_entry_point_call(
// context,
// )
// } else {
native_entry_point_execution::execute_entry_point_call(
let pre_time = std::time::Instant::now();
let mut result = native_entry_point_execution::execute_entry_point_call(
call,
compiled_class,
state,
context,
)?
)?;
result.time = pre_time.elapsed();
Ok(result)
// }
}
};

result.time = pre_time.elapsed();

Ok(result)
}
}

pub fn update_remaining_gas(remaining_gas: &mut u64, call_info: &CallInfo) {
Expand Down

0 comments on commit 5f91e8e

Please sign in to comment.