Skip to content

Commit

Permalink
test(es/base): Disable flaky benchmark (#9221)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Jul 12, 2024
1 parent e3f1fd1 commit bd4bef1
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions crates/swc/benches/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use swc_common::{
use swc_compiler_base::PrintArgs;
use swc_ecma_ast::{EsVersion, Program};
use swc_ecma_parser::Syntax;
use swc_ecma_transforms::{fixer, hygiene, resolver, typescript};
use swc_ecma_transforms::{fixer, resolver, typescript};
use swc_ecma_visit::FoldWith;

static SOURCE: &str = include_str!("assets/Observable.ts");
Expand Down Expand Up @@ -58,10 +58,10 @@ fn as_es(c: &swc::Compiler) -> Program {

fn base_tr_group(c: &mut Criterion) {
c.bench_function("es/full/base/fixer", base_tr_fixer);
c.bench_function(
"es/full/base/resolver_and_hygiene",
base_tr_resolver_and_hygiene,
);
// c.bench_function(
// "es/full/base/resolver_and_hygiene",
// base_tr_resolver_and_hygiene,
// );
}

fn base_tr_fixer(b: &mut Bencher) {
Expand All @@ -80,24 +80,25 @@ fn base_tr_fixer(b: &mut Bencher) {
});
}

fn base_tr_resolver_and_hygiene(b: &mut Bencher) {
let c = mk();
GLOBALS.set(&Default::default(), || {
let module = as_es(&c);

b.iter(|| {
GLOBALS.set(&Default::default(), || {
let handler = Handler::with_emitter_writer(Box::new(stderr()), Some(c.cm.clone()));
black_box(c.run_transform(&handler, true, || {
module
.clone()
.fold_with(&mut resolver(Mark::new(), Mark::new(), false))
.fold_with(&mut hygiene())
}))
})
});
})
}
// fn base_tr_resolver_and_hygiene(b: &mut Bencher) {
// let c = mk();
// GLOBALS.set(&Default::default(), || {
// let module = as_es(&c);

// b.iter(|| {
// GLOBALS.set(&Default::default(), || {
// let handler =
// Handler::with_emitter_writer(Box::new(stderr()), Some(c.cm.clone()));
// black_box(c.run_transform(&handler, true, || {
// module
// .clone()
// .fold_with(&mut resolver(Mark::new(), Mark::new(),
// false)) .fold_with(&mut hygiene())
// }))
// })
// });
// })
// }

/// This benchmark exists to know exact execution time of each pass.

Expand Down

0 comments on commit bd4bef1

Please sign in to comment.