Skip to content

Commit

Permalink
Add compile bench
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Nov 7, 2024
1 parent f21ffda commit dbb6fc7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use cairo_lang_starknet::contract::get_contracts_info;
use cairo_native::{
cache::{AotProgramCache, JitProgramCache},
context::NativeContext,
executor::AotNativeExecutor,
utils::find_function_id,
OptLevel, Value,
};
Expand Down Expand Up @@ -54,6 +55,25 @@ fn criterion_benchmark(c: &mut Criterion) {
.find_function("main")
.expect("failed to find main logistic map function");

{
let mut logistic_map_compilation_group = c.benchmark_group("logistic_map_compilation");

logistic_map_compilation_group.bench_function("Native", |b| {
b.iter(|| {
let context = NativeContext::new();
let module = context.compile(&logistic_map, false).unwrap();
AotNativeExecutor::from_native_module(module, OptLevel::Aggressive);
});
});
logistic_map_compilation_group.bench_function("VM", |b| {
b.iter(|| {
load_contract_for_vm("programs/benches/logistic_map.cairo");
});
});

logistic_map_compilation_group.finish();
}

{
let mut factorial_group = c.benchmark_group("factorial_2M");

Expand Down

0 comments on commit dbb6fc7

Please sign in to comment.