Skip to content

Commit

Permalink
bench
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jul 11, 2024
1 parent a9f170a commit bf91d77
Show file tree
Hide file tree
Showing 2 changed files with 443 additions and 0 deletions.
29 changes: 29 additions & 0 deletions crates/swc_fast_ts_strip/benches/assets.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion};
use swc_fast_ts_strip::{operate, Options};

static SOURCE: &str = include_str!("assets/AjaxObservable.ts");

fn fast_ts(c: &mut Criterion) {
c.bench_function("typescript/fast-strip", fast_typescript);
}
fn fast_typescript(b: &mut Bencher) {
let _ = ::testing::run_test(false, |cm, handler| {
b.iter(|| {
black_box(operate(
&cm,
handler,
black_box(SOURCE.to_string()),
Options {
module: None,
filename: None,
parser: Default::default(),
},
))
});

Ok(())
});
}

criterion_group!(benches, fast_ts);
criterion_main!(benches);
Loading

0 comments on commit bf91d77

Please sign in to comment.