mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 06:36:08 +03:00
perf(es/transforms): Exclude old inlining pass (#6203)
**Related issue:** - Closes https://github.com/swc-project/swc/issues/6194.
This commit is contained in:
parent
b48ec880fd
commit
27896f4751
@ -2,7 +2,7 @@ extern crate swc_node_base;
|
||||
|
||||
use std::{io::stderr, path::Path};
|
||||
|
||||
use criterion::{criterion_group, criterion_main, Bencher, Criterion};
|
||||
use criterion::{black_box, criterion_group, criterion_main, Bencher, Criterion};
|
||||
use swc::config::{Config, IsModule, Options};
|
||||
use swc_common::{errors::Handler, sync::Lrc, FilePathMapping, SourceMap};
|
||||
use swc_ecma_utils::swc_common::GLOBALS;
|
||||
@ -37,7 +37,7 @@ fn bench_file(b: &mut Bencher, path: &Path) {
|
||||
.unwrap()
|
||||
})
|
||||
};
|
||||
println!("{}", result.code);
|
||||
black_box(result);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
function foo() {
|
||||
let arr;
|
||||
let arr = [];
|
||||
arr = [
|
||||
1,
|
||||
2,
|
||||
|
@ -25,7 +25,6 @@ pub struct Config {
|
||||
pub fn simplifier(unresolved_mark: Mark, c: Config) -> impl RepeatedJsPass {
|
||||
Repeat::new(chain!(
|
||||
expr_simplifier(unresolved_mark, c.expr),
|
||||
inlining::inlining(c.inlining),
|
||||
dead_branch_remover(unresolved_mark),
|
||||
dce::dce(c.dce, unresolved_mark)
|
||||
))
|
||||
|
@ -8,7 +8,9 @@ use swc_ecma_transforms_base::{helpers::inject_helpers, resolver};
|
||||
use swc_ecma_transforms_compat::{es2015, es2016, es2017, es2018, es2022::class_properties, es3};
|
||||
use swc_ecma_transforms_module::{common_js::common_js, import_analysis::import_analyzer};
|
||||
use swc_ecma_transforms_optimization::simplify::{
|
||||
dce::dce, dead_branch_remover, expr_simplifier, inlining::inlining, simplifier,
|
||||
dce::{self, dce},
|
||||
dead_branch_remover, expr_simplifier,
|
||||
inlining::{self, inlining},
|
||||
};
|
||||
use swc_ecma_transforms_proposal::decorators;
|
||||
use swc_ecma_transforms_testing::{test, test_transform};
|
||||
@ -23,7 +25,12 @@ fn test(src: &str, expected: &str) {
|
||||
|
||||
chain!(
|
||||
resolver(unresolved_mark, top_level_mark, false),
|
||||
simplifier(unresolved_mark, Default::default())
|
||||
Repeat::new(chain!(
|
||||
expr_simplifier(unresolved_mark, Default::default()),
|
||||
inlining::inlining(Default::default()),
|
||||
dead_branch_remover(unresolved_mark),
|
||||
dce::dce(Default::default(), unresolved_mark)
|
||||
)),
|
||||
)
|
||||
},
|
||||
src,
|
||||
@ -46,7 +53,12 @@ macro_rules! to {
|
||||
|
||||
chain!(
|
||||
resolver(unresolved_mark, top_level_mark, false),
|
||||
simplifier(unresolved_mark, Default::default())
|
||||
Repeat::new(chain!(
|
||||
expr_simplifier(unresolved_mark, Default::default()),
|
||||
inlining::inlining(Default::default()),
|
||||
dead_branch_remover(unresolved_mark),
|
||||
dce::dce(Default::default(), unresolved_mark)
|
||||
)),
|
||||
)
|
||||
},
|
||||
$name,
|
||||
@ -574,7 +586,12 @@ test!(
|
||||
resolver(unresolved_mark, top_level_mark, false),
|
||||
strip(top_level_mark),
|
||||
class_properties(Some(t.comments.clone()), Default::default()),
|
||||
simplifier(unresolved_mark, Default::default()),
|
||||
Repeat::new(chain!(
|
||||
expr_simplifier(unresolved_mark, Default::default()),
|
||||
inlining::inlining(Default::default()),
|
||||
dead_branch_remover(unresolved_mark),
|
||||
dce::dce(Default::default(), unresolved_mark)
|
||||
)),
|
||||
es2018(Default::default()),
|
||||
es2017(
|
||||
Default::default(),
|
||||
|
@ -799,10 +799,9 @@ fn html5lib_test_tree_construction(input: PathBuf) {
|
||||
|| file_name.contains("svg_dat.5.fragment_tbody")
|
||||
|| file_name.contains("svg_dat.6.fragment_tbody")
|
||||
|| file_name.contains("svg_dat.7.fragment_tbody")
|
||||
|| file_name.contains("foreign-fragment_dat.3.fragment_svg_path")
|
||||
{
|
||||
errors.len() - 1
|
||||
} else if file_name.contains("foreign-fragment_dat.3.fragment_svg_path") {
|
||||
errors.len() - 1
|
||||
} else {
|
||||
errors.len()
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user