Skip to content

Commit

Permalink
add compile benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaBatty committed Aug 11, 2023
1 parent ca9f6c1 commit 2801640
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions sway-lsp/benches/bench_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ use criterion::criterion_main;
criterion_main! {
lsp_benchmarks::token_map::benches,
lsp_benchmarks::requests::benches,
lsp_benchmarks::compile::benches,
}
15 changes: 15 additions & 0 deletions sway-lsp/benches/lsp_benchmarks/compile.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use criterion::{black_box, criterion_group, Criterion};

fn benchmarks(c: &mut Criterion) {
c.bench_function("compile_and_traverse", |b| {
b.iter(|| {
let _ = black_box(super::compile_test_project());
})
});
}

criterion_group! {
name = benches;
config = Criterion::default().measurement_time(std::time::Duration::from_secs(10));
targets = benchmarks
}
1 change: 1 addition & 0 deletions sway-lsp/benches/lsp_benchmarks/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod compile;
pub mod requests;
pub mod token_map;

Expand Down

0 comments on commit 2801640

Please sign in to comment.