Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(es/transforms): Exclude old inlining pass #6203

Merged
merged 7 commits into from Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/swc/benches/bugs.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -37,7 +37,7 @@ fn bench_file(b: &mut Bencher, path: &Path) {
.unwrap()
})
};
println!("{}", result.code);
black_box(result);
});
}

Expand Down
Expand Up @@ -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)
))
Expand Down
25 changes: 21 additions & 4 deletions crates/swc_ecma_transforms_optimization/tests/simplify.rs
Expand Up @@ -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};
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down
3 changes: 1 addition & 2 deletions crates/swc_html_parser/tests/html5lib_tests.rs
Expand Up @@ -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()
};
Expand Down