Skip to content

Commit

Permalink
chore: Break cycles (#2941)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Dec 2, 2021
1 parent 67dc0d3 commit 0304c55
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 26 deletions.
5 changes: 0 additions & 5 deletions .husky/pre-commit

This file was deleted.

1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/swc_ecma_transforms_compat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@ swc_ecma_visit = {version = "0.44.0", path = "../swc_ecma_visit"}
serde_json = "1.0.66"
swc_ecma_parser = {version = "0.78.0", path = "../swc_ecma_parser"}
swc_ecma_transforms_testing = {version = "0.45.2", path = "../swc_ecma_transforms_testing"}
swc_ecma_transforms_typescript = {version = "0.62.0", path = "../swc_ecma_transforms_typescript"}
testing = {version = "0.15.0", path = "../testing"}
19 changes: 0 additions & 19 deletions crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use swc_ecma_transforms_compat::{
es2017::async_to_generator,
};
use swc_ecma_transforms_testing::{test, test_exec};
use swc_ecma_transforms_typescript::strip;
use swc_ecma_visit::Fold;

fn syntax() -> Syntax {
Expand Down Expand Up @@ -1901,24 +1900,6 @@ test_exec!(
expect(t([4,5,6])).toBe(6);"
);

test!(
Syntax::Typescript(Default::default()),
|_| chain!(
strip(),
tr(Config {
ignore_function_length: true
})
),
fn_len_default_assignment_with_types,
"export function transformFileSync(
filename: string,
opts?: Object = {},
): string {}",
"export function transformFileSync(filename, opts) {
if (opts === void 0) opts = {};
}"
);

test_exec!(
syntax(),
|_| tr(Config {
Expand Down
22 changes: 22 additions & 0 deletions crates/swc_ecma_transforms_typescript/tests/strip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use swc_common::chain;
use swc_ecma_parser::{Syntax, TsConfig};
use swc_ecma_transforms_base::resolver::resolver;
use swc_ecma_transforms_compat::{
es2015::{block_scoping, destructuring, parameters},
es2017::async_to_generator,
es2020::{nullish_coalescing, optional_chaining},
};
Expand All @@ -19,6 +20,27 @@ fn tr() -> impl Fold {
})
}

test!(
Syntax::Typescript(Default::default()),
|_| chain!(
strip(),
resolver(),
parameters(parameters::Config {
ignore_function_length: true
}),
destructuring(destructuring::Config { loose: false }),
block_scoping(),
),
fn_len_default_assignment_with_types,
"export function transformFileSync(
filename: string,
opts?: Object = {},
): string {}",
"export function transformFileSync(filename, opts) {
if (opts === void 0) opts = {};
}"
);

macro_rules! to {
($name:ident, $from:expr, $to:expr) => {
test!(
Expand Down

1 comment on commit 0304c55

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 0304c55 Previous: 67dc0d3 Ratio
base_tr_fixer 26021 ns/iter (± 481) 20286 ns/iter (± 3112) 1.28
base_tr_resolver_and_hygiene 153227 ns/iter (± 29554) 116311 ns/iter (± 13262) 1.32
codegen_es2015 60813 ns/iter (± 911) 49123 ns/iter (± 10276) 1.24
codegen_es2016 60730 ns/iter (± 484) 45347 ns/iter (± 5632) 1.34
codegen_es2017 60410 ns/iter (± 538) 43528 ns/iter (± 7596) 1.39
codegen_es2018 60831 ns/iter (± 409) 41755 ns/iter (± 7619) 1.46
codegen_es2019 60342 ns/iter (± 1054) 45207 ns/iter (± 6858) 1.33
codegen_es2020 61191 ns/iter (± 1277) 45225 ns/iter (± 10460) 1.35
codegen_es3 60476 ns/iter (± 1125) 44011 ns/iter (± 11722) 1.37
codegen_es5 60838 ns/iter (± 1955) 43395 ns/iter (± 6911) 1.40
full_es2015 213755056 ns/iter (± 18263246) 169484979 ns/iter (± 14925691) 1.26
full_es2016 172362121 ns/iter (± 20056430) 136821416 ns/iter (± 16670713) 1.26
full_es2017 182138963 ns/iter (± 12881140) 141828223 ns/iter (± 15101204) 1.28
full_es2018 180922750 ns/iter (± 16307038) 138044301 ns/iter (± 15679565) 1.31
full_es2019 175781355 ns/iter (± 12502344) 158176534 ns/iter (± 29876135) 1.11
full_es2020 174940534 ns/iter (± 19335989) 159043250 ns/iter (± 10580232) 1.10
full_es3 253309470 ns/iter (± 23543493) 212520507 ns/iter (± 15214386) 1.19
full_es5 234641013 ns/iter (± 21135305) 196920634 ns/iter (± 17518188) 1.19
parser 788145 ns/iter (± 28355) 711759 ns/iter (± 109552) 1.11
ser_ast_node 181 ns/iter (± 3) 156 ns/iter (± 18) 1.16
ser_serde 182 ns/iter (± 2) 159 ns/iter (± 17) 1.14
emit_colors 22534928 ns/iter (± 28828085) 18862784 ns/iter (± 22142158) 1.19
emit_large 108138166 ns/iter (± 165272820) 113393327 ns/iter (± 167691192) 0.95
base_clone 2873116 ns/iter (± 115414) 2414174 ns/iter (± 397991) 1.19
fold_span 4770719 ns/iter (± 412934) 3824601 ns/iter (± 417273) 1.25
fold_span_panic 4932196 ns/iter (± 456016) 4005124 ns/iter (± 428276) 1.23
visit_mut_span 3515577 ns/iter (± 506688) 2854605 ns/iter (± 279063) 1.23
visit_mut_span_panic 3618302 ns/iter (± 380231) 2885717 ns/iter (± 360233) 1.25
ast_clone 20314 ns/iter (± 182) 16433 ns/iter (± 4684) 1.24
ast_clone_to_stable 59918 ns/iter (± 838) 48036 ns/iter (± 11996) 1.25
ast_clone_to_stable_then_to_unstable 111288 ns/iter (± 1318) 87274 ns/iter (± 13215) 1.28
json_deserialize 2295301 ns/iter (± 6591) 1901292 ns/iter (± 278269) 1.21
json_serialize 109714 ns/iter (± 457) 91134 ns/iter (± 20918) 1.20
boxing_boxed 147 ns/iter (± 0) 119 ns/iter (± 15) 1.24
boxing_boxed_clone 80 ns/iter (± 0) 68 ns/iter (± 20) 1.18
boxing_unboxed 144 ns/iter (± 0) 112 ns/iter (± 31) 1.29
boxing_unboxed_clone 74 ns/iter (± 5) 62 ns/iter (± 9) 1.19
time_10 386 ns/iter (± 5) 315 ns/iter (± 39) 1.23
time_15 884 ns/iter (± 8) 675 ns/iter (± 106) 1.31
time_20 1479 ns/iter (± 6) 1172 ns/iter (± 177) 1.26
time_40 4838 ns/iter (± 43) 3945 ns/iter (± 504) 1.23
time_5 125 ns/iter (± 2) 107 ns/iter (± 16) 1.17
time_60 10186 ns/iter (± 38) 8745 ns/iter (± 1900) 1.16

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.