Skip to content

Commit

Permalink
Add compile bench for other programs
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Nov 7, 2024
1 parent dbb6fc7 commit 159bbca
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,44 @@ fn criterion_benchmark(c: &mut Criterion) {
logistic_map_compilation_group.finish();
}

{
let mut factorial_compilation_group = c.benchmark_group("factorial_compilation");

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

factorial_compilation_group.finish();
}

{
let mut fibonacci_compilation_group = c.benchmark_group("fibonacci_compilation");

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

fibonacci_compilation_group.finish();
}

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

Expand Down

0 comments on commit 159bbca

Please sign in to comment.