Skip to content

Commit

Permalink
feat(css/parser): Normalize dimension (#6654)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 16, 2022
1 parent 779383a commit 3d3863d
Show file tree
Hide file tree
Showing 24 changed files with 668 additions and 143 deletions.
2 changes: 1 addition & 1 deletion crates/swc_css_ast/src/lib.rs
Expand Up @@ -14,7 +14,7 @@ mod value;
///
/// The type of value and patterns should be identical.
///
/// # Exmaples
/// # Examples
///
/// ```
/// use swc_atoms::JsWord;
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_css_minifier/src/compressor/angle.rs
Expand Up @@ -37,7 +37,7 @@ impl Compressor {
return;
}

let from = match get_angle_type(&angle.unit.value.to_ascii_lowercase()) {
let from = match get_angle_type(&angle.unit.value) {
Some(angel_type) => angel_type,
None => return,
};
Expand Down
103 changes: 51 additions & 52 deletions crates/swc_css_minifier/src/compressor/calc_sum.rs
Expand Up @@ -291,8 +291,7 @@ impl CalcSumContext {
}

fn sum_length(&mut self, operator: Option<&CalcOperator>, operand: &CalcProduct, l: &Length) {
let unit = l.unit.value.to_ascii_lowercase();
if is_absolute_length(unit) {
if is_absolute_length(&l.unit.value) {
self.sum_absolute_length(operator, operand, l)
} else {
self.sum_other_length(operator, operand, l)
Expand All @@ -310,17 +309,17 @@ impl CalcSumContext {
operator: prev_operator,
operand: IndexedData { pos, data },
}) => {
let prev_unit = data.unit.value.to_ascii_lowercase();
let unit = l.unit.value.to_ascii_lowercase();
if let Some(result) = get_absolute_length_ratio(prev_unit, unit).and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
l.value.value,
Some(ratio),
)
}) {
if let Some(result) = get_absolute_length_ratio(&data.unit.value, &l.unit.value)
.and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
l.value.value,
Some(ratio),
)
})
{
data.value.value = result;

CalcSumContext::switch_sign_if_needed(
Expand Down Expand Up @@ -351,8 +350,7 @@ impl CalcSumContext {
operand: &CalcProduct,
l: &Length,
) {
let unit = l.unit.value.to_ascii_lowercase();
match &mut self.other_lengths.get_mut(&unit) {
match &mut self.other_lengths.get_mut(&l.unit.value) {
Some(IndexedOperatorAndOperand {
operator: prev_operator,
operand: IndexedData { pos, data },
Expand Down Expand Up @@ -384,7 +382,8 @@ impl CalcSumContext {
None => {
let indexed_data: IndexedOperatorAndOperand<Length> =
self.new_indexed_data(operator, operand, l.clone());
self.other_lengths.insert(unit, indexed_data);
self.other_lengths
.insert(l.unit.value.clone(), indexed_data);
}
}
}
Expand Down Expand Up @@ -430,17 +429,17 @@ impl CalcSumContext {
operator: prev_operator,
operand: IndexedData { pos, data },
}) => {
let prev_unit = data.unit.value.to_ascii_lowercase();
let unit = d.unit.value.to_ascii_lowercase();
if let Some(result) = get_duration_ratio(prev_unit, unit).and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
d.value.value,
Some(ratio),
)
}) {
if let Some(result) =
get_duration_ratio(&data.unit.value, &d.unit.value).and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
d.value.value,
Some(ratio),
)
})
{
data.value.value = result;

CalcSumContext::switch_sign_if_needed(
Expand Down Expand Up @@ -474,17 +473,17 @@ impl CalcSumContext {
operator: prev_operator,
operand: IndexedData { pos, data },
}) => {
let prev_unit = data.unit.value.to_ascii_lowercase();
let unit = f.unit.value.to_ascii_lowercase();
if let Some(result) = get_frequency_ratio(prev_unit, unit).and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
f.value.value,
Some(ratio),
)
}) {
if let Some(result) =
get_frequency_ratio(&data.unit.value, &f.unit.value).and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
f.value.value,
Some(ratio),
)
})
{
data.value.value = result;

CalcSumContext::switch_sign_if_needed(
Expand Down Expand Up @@ -518,17 +517,17 @@ impl CalcSumContext {
operator: prev_operator,
operand: IndexedData { pos, data },
}) => {
let prev_unit = data.unit.value.to_ascii_lowercase();
let unit = r.unit.value.to_ascii_lowercase();
if let Some(result) = get_resolution_ratio(prev_unit, unit).and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
r.value.value,
Some(ratio),
)
}) {
if let Some(result) = get_resolution_ratio(&data.unit.value, &r.unit.value)
.and_then(|ratio| {
CalcSumContext::try_to_sum_values(
prev_operator.as_ref(),
operator,
data.value.value,
r.value.value,
Some(ratio),
)
})
{
data.value.value = result;

CalcSumContext::switch_sign_if_needed(
Expand Down Expand Up @@ -591,8 +590,7 @@ impl CalcSumContext {
operand: &CalcProduct,
u: &UnknownDimension,
) {
let unit = u.unit.value.to_ascii_lowercase();
match &mut self.unknown_dimension.get_mut(&unit) {
match &mut self.unknown_dimension.get_mut(&u.unit.value) {
Some(IndexedOperatorAndOperand {
operator: prev_operator,
operand: IndexedData { pos, data },
Expand Down Expand Up @@ -625,7 +623,8 @@ impl CalcSumContext {
None => {
let indexed_data: IndexedOperatorAndOperand<UnknownDimension> =
self.new_indexed_data(operator, operand, u.clone());
self.unknown_dimension.insert(unit, indexed_data);
self.unknown_dimension
.insert(u.unit.value.clone(), indexed_data);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_css_minifier/src/compressor/color.rs
Expand Up @@ -324,7 +324,7 @@ impl Compressor {
unit: Ident { value: unit, .. },
..
}) => {
let angel_type = match get_angle_type(&unit.to_ascii_lowercase()) {
let angel_type = match get_angle_type(unit) {
Some(angel_type) => angel_type,
_ => return None,
};
Expand Down
12 changes: 2 additions & 10 deletions crates/swc_css_minifier/src/compressor/declaration.rs
Expand Up @@ -536,11 +536,7 @@ impl Compressor {
unit: unit_2,
..
}))),
) if value_1.value == value_2.value
&& unit_1.value.eq_ignore_ascii_case(&unit_2.value) =>
{
true
}
) if value_1.value == value_2.value && unit_1.value == unit_2.value => true,
(
Some(ComponentValue::Integer(box Integer { value: 0, .. })),
Some(ComponentValue::Integer(box Integer { value: 0, .. })),
Expand Down Expand Up @@ -576,11 +572,7 @@ impl Compressor {
unit: unit_2,
..
}))),
) if value_1.value == value_2.value
&& unit_1.value.eq_ignore_ascii_case(&unit_2.value) =>
{
true
}
) if value_1.value == value_2.value && unit_1.value == unit_2.value => true,
(
Some(ComponentValue::Percentage(box Percentage { value: value_1, .. })),
Some(ComponentValue::Percentage(box Percentage { value: value_2, .. })),
Expand Down
2 changes: 1 addition & 1 deletion crates/swc_css_minifier/src/compressor/frequency.rs
Expand Up @@ -5,7 +5,7 @@ use super::Compressor;

impl Compressor {
pub(super) fn compress_frequency(&mut self, frequency: &mut Frequency) {
match frequency.unit.value.to_ascii_lowercase() {
match frequency.unit.value {
js_word!("hz")
if frequency.value.value > 0.0 && frequency.value.value % 1000.0 == 0.0 =>
{
Expand Down
41 changes: 20 additions & 21 deletions crates/swc_css_minifier/src/compressor/length.rs
Expand Up @@ -4,9 +4,9 @@ use swc_css_ast::*;
use super::Compressor;

impl Compressor {
fn convert_length(&mut self, value: f64, from_unit: JsWord, to_unit: JsWord) -> f64 {
match to_unit {
js_word!("cm") => match from_unit {
fn convert_length(&mut self, value: f64, from_unit: &JsWord, to_unit: &JsWord) -> f64 {
match *to_unit {
js_word!("cm") => match *from_unit {
js_word!("cm") => value,
js_word!("mm") => value / 10.0,
js_word!("q") => value / 40.0,
Expand All @@ -18,7 +18,7 @@ impl Compressor {
unreachable!()
}
},
js_word!("mm") => match from_unit {
js_word!("mm") => match *from_unit {
js_word!("cm") => 10.0 * value,
js_word!("mm") => value,
js_word!("q") => value / 4.0,
Expand All @@ -30,7 +30,7 @@ impl Compressor {
unreachable!()
}
},
js_word!("q") => match from_unit {
js_word!("q") => match *from_unit {
js_word!("cm") => 40.0 * value,
js_word!("mm") => 4.0 * value,
js_word!("q") => value,
Expand All @@ -42,7 +42,7 @@ impl Compressor {
unreachable!()
}
},
js_word!("in") => match from_unit {
js_word!("in") => match *from_unit {
js_word!("cm") => value / 2.54,
js_word!("mm") => value / 25.4,
js_word!("q") => value / 101.6,
Expand All @@ -54,7 +54,7 @@ impl Compressor {
unreachable!()
}
},
js_word!("pc") => match from_unit {
js_word!("pc") => match *from_unit {
js_word!("cm") => 6.0 / 2.54 * value,
js_word!("mm") => 6.0 / 25.4 * value,
js_word!("q") => 6.0 / 101.6 * value,
Expand All @@ -66,7 +66,7 @@ impl Compressor {
unreachable!()
}
},
js_word!("pt") => match from_unit {
js_word!("pt") => match *from_unit {
js_word!("cm") => 72.0 / 2.54 * value,
js_word!("mm") => 72.0 / 25.4 * value,
js_word!("q") => 72.0 / 101.6 * value,
Expand All @@ -78,7 +78,7 @@ impl Compressor {
unreachable!()
}
},
js_word!("px") => match from_unit {
js_word!("px") => match *from_unit {
js_word!("cm") => 96.0 / 2.54 * value,
js_word!("mm") => 96.0 / 25.4 * value,
js_word!("q") => 96.0 / 101.6 * value,
Expand Down Expand Up @@ -134,13 +134,12 @@ impl Compressor {
}

pub(super) fn compress_length(&mut self, length: &mut Length) {
let from = length.unit.value.to_ascii_lowercase();
let value = length.value.value;

match from {
match length.unit.value {
js_word!("cm") => {
if value % 2.54 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("in"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("in"));

length.value = Number {
span: length.value.span,
Expand All @@ -153,7 +152,7 @@ impl Compressor {
raw: None,
};
} else if value <= 0.1 {
let new_value = self.convert_length(value, from, js_word!("mm"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("mm"));

length.value = Number {
span: length.value.span,
Expand All @@ -169,7 +168,7 @@ impl Compressor {
}
js_word!("mm") => {
if value % 25.4 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("in"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("in"));

length.value = Number {
span: length.value.span,
Expand All @@ -182,7 +181,7 @@ impl Compressor {
raw: None,
};
} else if value % 10.0 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("cm"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("cm"));

length.value = Number {
span: length.value.span,
Expand All @@ -198,7 +197,7 @@ impl Compressor {
}
js_word!("q") => {
if value > 80.0 && value % 40.0 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("cm"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("cm"));

length.value = Number {
span: length.value.span,
Expand All @@ -211,7 +210,7 @@ impl Compressor {
raw: None,
};
} else if value % 101.6 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("in"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("in"));

length.value = Number {
span: length.value.span,
Expand All @@ -227,7 +226,7 @@ impl Compressor {
}
js_word!("pc") => {
if value % 6.0 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("in"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("in"));

length.value = Number {
span: length.value.span,
Expand All @@ -243,7 +242,7 @@ impl Compressor {
}
js_word!("pt") => {
if value % 72.0 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("in"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("in"));

length.value = Number {
span: length.value.span,
Expand All @@ -256,7 +255,7 @@ impl Compressor {
raw: None,
};
} else if value % 12.0 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("pc"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("pc"));

length.value = Number {
span: length.value.span,
Expand All @@ -269,7 +268,7 @@ impl Compressor {
raw: None,
};
} else if value % 0.75 == 0.0 {
let new_value = self.convert_length(value, from, js_word!("px"));
let new_value = self.convert_length(value, &length.unit.value, &js_word!("px"));

length.value = Number {
span: length.value.span,
Expand Down

1 comment on commit 3d3863d

@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: 3d3863d Previous: 1fc97a7 Ratio
es/full/bugs-1 309165 ns/iter (± 11188) 311176 ns/iter (± 9808) 0.99
es/full/minify/libraries/antd 1803644781 ns/iter (± 19644694) 1775581873 ns/iter (± 27499485) 1.02
es/full/minify/libraries/d3 324440941 ns/iter (± 4801873) 312728891 ns/iter (± 5383083) 1.04
es/full/minify/libraries/echarts 1381203816 ns/iter (± 11657545) 1363716880 ns/iter (± 9199524) 1.01
es/full/minify/libraries/jquery 94004610 ns/iter (± 863382) 91990533 ns/iter (± 1703350) 1.02
es/full/minify/libraries/lodash 109962930 ns/iter (± 1125769) 108678784 ns/iter (± 562263) 1.01
es/full/minify/libraries/moment 54466010 ns/iter (± 1960930) 53760617 ns/iter (± 220051) 1.01
es/full/minify/libraries/react 19367399 ns/iter (± 101522) 19298838 ns/iter (± 140954) 1.00
es/full/minify/libraries/terser 272368492 ns/iter (± 3390504) 262343731 ns/iter (± 2772658) 1.04
es/full/minify/libraries/three 490547481 ns/iter (± 7223233) 479505586 ns/iter (± 10934774) 1.02
es/full/minify/libraries/typescript 3328139453 ns/iter (± 36946273) 3333243105 ns/iter (± 26354226) 1.00
es/full/minify/libraries/victory 762426651 ns/iter (± 12359824) 749094432 ns/iter (± 14544727) 1.02
es/full/minify/libraries/vue 137859285 ns/iter (± 2058655) 134491174 ns/iter (± 1320755) 1.03
es/full/codegen/es3 27693 ns/iter (± 52) 27398 ns/iter (± 73) 1.01
es/full/codegen/es5 27809 ns/iter (± 67) 27474 ns/iter (± 50) 1.01
es/full/codegen/es2015 27708 ns/iter (± 80) 27380 ns/iter (± 47) 1.01
es/full/codegen/es2016 27799 ns/iter (± 78) 27421 ns/iter (± 61) 1.01
es/full/codegen/es2017 27691 ns/iter (± 67) 27398 ns/iter (± 67) 1.01
es/full/codegen/es2018 27763 ns/iter (± 56) 27444 ns/iter (± 71) 1.01
es/full/codegen/es2019 27671 ns/iter (± 44) 27404 ns/iter (± 41) 1.01
es/full/codegen/es2020 27699 ns/iter (± 64) 27385 ns/iter (± 48) 1.01
es/full/all/es3 173557368 ns/iter (± 2978172) 171037184 ns/iter (± 1769984) 1.01
es/full/all/es5 163609562 ns/iter (± 2443079) 162278752 ns/iter (± 1441436) 1.01
es/full/all/es2015 126421647 ns/iter (± 2950440) 121432395 ns/iter (± 1227312) 1.04
es/full/all/es2016 123450121 ns/iter (± 2752297) 120986801 ns/iter (± 1537505) 1.02
es/full/all/es2017 123074278 ns/iter (± 1778446) 120357674 ns/iter (± 1164235) 1.02
es/full/all/es2018 120466390 ns/iter (± 719618) 118428708 ns/iter (± 1265959) 1.02
es/full/all/es2019 120189822 ns/iter (± 1560724) 118075555 ns/iter (± 1620599) 1.02
es/full/all/es2020 115392515 ns/iter (± 1220610) 112930538 ns/iter (± 1116164) 1.02
es/full/parser 517343 ns/iter (± 9347) 515877 ns/iter (± 7226) 1.00
es/full/base/fixer 22225 ns/iter (± 35) 21962 ns/iter (± 42) 1.01
es/full/base/resolver_and_hygiene 78025 ns/iter (± 128) 78497 ns/iter (± 105) 0.99
serialization of ast node 139 ns/iter (± 0) 138 ns/iter (± 0) 1.01
serialization of serde 124 ns/iter (± 0) 124 ns/iter (± 0) 1
css/minify/libraries/bootstrap 27252934 ns/iter (± 634341) 27002188 ns/iter (± 87744) 1.01
css/visitor/compare/clone 2085399 ns/iter (± 20750) 2085060 ns/iter (± 14968) 1.00
css/visitor/compare/visit_mut_span 2305466 ns/iter (± 15850) 2297396 ns/iter (± 7861) 1.00
css/visitor/compare/visit_mut_span_panic 2349001 ns/iter (± 6294) 2382957 ns/iter (± 6375) 0.99
css/visitor/compare/fold_span 3034571 ns/iter (± 30576) 3058284 ns/iter (± 24136) 0.99
css/visitor/compare/fold_span_panic 3176955 ns/iter (± 47988) 3149914 ns/iter (± 26293) 1.01
css/lexer/bootstrap_5_1_3 5349618 ns/iter (± 1865) 5266184 ns/iter (± 6834) 1.02
css/lexer/foundation_6_7_4 4420599 ns/iter (± 1727) 4429143 ns/iter (± 3168) 1.00
css/lexer/tailwind_3_1_1 829417 ns/iter (± 185) 832377 ns/iter (± 1361) 1.00
css/parser/bootstrap_5_1_3 21475844 ns/iter (± 72229) 21087312 ns/iter (± 47860) 1.02
css/parser/foundation_6_7_4 17047445 ns/iter (± 37674) 16788559 ns/iter (± 41054) 1.02
css/parser/tailwind_3_1_1 3250005 ns/iter (± 6288) 3231035 ns/iter (± 10168) 1.01
es/codegen/colors 322873 ns/iter (± 181339) 324875 ns/iter (± 181931) 0.99
es/codegen/large 1219555 ns/iter (± 644558) 1245815 ns/iter (± 633547) 0.98
es/codegen/with-parser/colors 46815 ns/iter (± 310) 46632 ns/iter (± 327) 1.00
es/codegen/with-parser/large 509704 ns/iter (± 3092) 511406 ns/iter (± 1679) 1.00
es/minify/libraries/antd 1573128362 ns/iter (± 31570166) 1565650346 ns/iter (± 26597360) 1.00
es/minify/libraries/d3 276767153 ns/iter (± 5788516) 268500189 ns/iter (± 4810400) 1.03
es/minify/libraries/echarts 1189808687 ns/iter (± 9640247) 1172715515 ns/iter (± 9850203) 1.01
es/minify/libraries/jquery 80646398 ns/iter (± 778064) 79439898 ns/iter (± 727808) 1.02
es/minify/libraries/lodash 98496085 ns/iter (± 1822368) 96970348 ns/iter (± 944225) 1.02
es/minify/libraries/moment 46820351 ns/iter (± 392800) 46974955 ns/iter (± 286344) 1.00
es/minify/libraries/react 17247853 ns/iter (± 183502) 17259795 ns/iter (± 151806) 1.00
es/minify/libraries/terser 231527671 ns/iter (± 6211630) 229933583 ns/iter (± 6011838) 1.01
es/minify/libraries/three 428359845 ns/iter (± 12313762) 399081446 ns/iter (± 9206746) 1.07
es/minify/libraries/typescript 2882676129 ns/iter (± 26121672) 2863139541 ns/iter (± 17888676) 1.01
es/minify/libraries/victory 671625714 ns/iter (± 10636538) 635373240 ns/iter (± 15140259) 1.06
es/minify/libraries/vue 124003669 ns/iter (± 2038454) 118275356 ns/iter (± 1890092) 1.05
es/visitor/compare/clone 2461793 ns/iter (± 61327) 2415176 ns/iter (± 4242) 1.02
es/visitor/compare/visit_mut_span 2817648 ns/iter (± 8659) 2842708 ns/iter (± 12448) 0.99
es/visitor/compare/visit_mut_span_panic 2890846 ns/iter (± 21041) 2888427 ns/iter (± 2894) 1.00
es/visitor/compare/fold_span 4006048 ns/iter (± 53376) 3990125 ns/iter (± 8103) 1.00
es/visitor/compare/fold_span_panic 4154615 ns/iter (± 15564) 4153102 ns/iter (± 12811) 1.00
es/lexer/colors 17260 ns/iter (± 7) 17225 ns/iter (± 31) 1.00
es/lexer/angular 8262840 ns/iter (± 6258) 8235156 ns/iter (± 17667) 1.00
es/lexer/backbone 1077903 ns/iter (± 278) 1072041 ns/iter (± 3376) 1.01
es/lexer/jquery 5983810 ns/iter (± 2497) 5968023 ns/iter (± 8869) 1.00
es/lexer/jquery mobile 9204069 ns/iter (± 10281) 9153202 ns/iter (± 12531) 1.01
es/lexer/mootools 4697022 ns/iter (± 4566) 4666119 ns/iter (± 7013) 1.01
es/lexer/underscore 901198 ns/iter (± 770) 895138 ns/iter (± 882) 1.01
es/lexer/three 28067382 ns/iter (± 14834) 27891988 ns/iter (± 30670) 1.01
es/lexer/yui 5066626 ns/iter (± 2037) 5046241 ns/iter (± 3710) 1.00
es/parser/colors 30970 ns/iter (± 157) 31230 ns/iter (± 203) 0.99
es/parser/angular 16825116 ns/iter (± 272679) 16190056 ns/iter (± 112070) 1.04
es/parser/backbone 2330480 ns/iter (± 16349) 2322015 ns/iter (± 13707) 1.00
es/parser/jquery 12960183 ns/iter (± 562416) 12680558 ns/iter (± 79496) 1.02
es/parser/jquery mobile 21402855 ns/iter (± 378515) 20740007 ns/iter (± 491092) 1.03
es/parser/mootools 9701416 ns/iter (± 45064) 9565262 ns/iter (± 42918) 1.01
es/parser/underscore 1973631 ns/iter (± 11113) 1969532 ns/iter (± 11077) 1.00
es/parser/three 62428764 ns/iter (± 300999) 61050618 ns/iter (± 555638) 1.02
es/parser/yui 9794072 ns/iter (± 62401) 9697221 ns/iter (± 91728) 1.01
es/preset-env/usage/builtin_type 139921 ns/iter (± 35307) 137577 ns/iter (± 30415) 1.02
es/preset-env/usage/property 21110 ns/iter (± 65) 21436 ns/iter (± 51) 0.98
es/resolver/typescript 122120337 ns/iter (± 2737111) 125439841 ns/iter (± 3176794) 0.97
es/fixer/typescript 99989353 ns/iter (± 6070042) 98838469 ns/iter (± 665946) 1.01
es/hygiene/typescript 200874717 ns/iter (± 1227148) 199157525 ns/iter (± 2671069) 1.01
es/resolver_with_hygiene/typescript 349035856 ns/iter (± 2804510) 343830721 ns/iter (± 1792413) 1.02
es/visitor/base-perf/module_clone 75723 ns/iter (± 1813) 76290 ns/iter (± 1619) 0.99
es/visitor/base-perf/fold_empty 85215 ns/iter (± 1897) 85937 ns/iter (± 1822) 0.99
es/visitor/base-perf/fold_noop_impl_all 84901 ns/iter (± 713) 85714 ns/iter (± 2341) 0.99
es/visitor/base-perf/fold_noop_impl_vec 85571 ns/iter (± 1218) 85986 ns/iter (± 1480) 1.00
es/visitor/base-perf/boxing_boxed_clone 59 ns/iter (± 0) 56 ns/iter (± 0) 1.05
es/visitor/base-perf/boxing_unboxed_clone 59 ns/iter (± 0) 59 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 103 ns/iter (± 0) 102 ns/iter (± 0) 1.01
es/visitor/base-perf/boxing_unboxed 106 ns/iter (± 0) 102 ns/iter (± 0) 1.04
es/visitor/base-perf/visit_contains_this 3399 ns/iter (± 67) 3641 ns/iter (± 113) 0.93
es/base/parallel/resolver/typescript 5064855948 ns/iter (± 423579931) 5635989023 ns/iter (± 492243651) 0.90
es/base/parallel/hygiene/typescript 2249873077 ns/iter (± 40928411) 2298814593 ns/iter (± 36261400) 0.98
misc/visitors/time-complexity/time 5 93 ns/iter (± 1) 93 ns/iter (± 0) 1
misc/visitors/time-complexity/time 10 327 ns/iter (± 3) 324 ns/iter (± 0) 1.01
misc/visitors/time-complexity/time 15 635 ns/iter (± 2) 646 ns/iter (± 10) 0.98
misc/visitors/time-complexity/time 20 1191 ns/iter (± 1) 1192 ns/iter (± 1) 1.00
misc/visitors/time-complexity/time 40 6150 ns/iter (± 1) 6183 ns/iter (± 12) 0.99
misc/visitors/time-complexity/time 60 15496 ns/iter (± 7) 15528 ns/iter (± 17) 1.00
es/full-target/es2016 188367 ns/iter (± 1145) 188881 ns/iter (± 383) 1.00
es/full-target/es2017 183716 ns/iter (± 538) 183356 ns/iter (± 492) 1.00
es/full-target/es2018 172448 ns/iter (± 820) 171819 ns/iter (± 436) 1.00
es2020_nullish_coalescing 66931 ns/iter (± 106) 66687 ns/iter (± 144) 1.00
es2020_optional_chaining 96014 ns/iter (± 5564) 95459 ns/iter (± 4563) 1.01
es2022_class_properties 93345 ns/iter (± 162) 93574 ns/iter (± 262) 1.00
es2018_object_rest_spread 70302 ns/iter (± 101) 71464 ns/iter (± 175) 0.98
es2019_optional_catch_binding 60148 ns/iter (± 89) 61066 ns/iter (± 161) 0.98
es2017_async_to_generator 60462 ns/iter (± 87) 61567 ns/iter (± 90) 0.98
es2016_exponentiation 63780 ns/iter (± 150) 64951 ns/iter (± 116) 0.98
es2015_arrow 68378 ns/iter (± 116) 70366 ns/iter (± 210) 0.97
es2015_block_scoped_fn 64400 ns/iter (± 63) 65986 ns/iter (± 122) 0.98
es2015_block_scoping 147650 ns/iter (± 9295) 138896 ns/iter (± 6716) 1.06
es2015_classes 113822 ns/iter (± 468) 117385 ns/iter (± 502) 0.97
es2015_computed_props 59686 ns/iter (± 106) 61081 ns/iter (± 148) 0.98
es2015_destructuring 112944 ns/iter (± 104) 116261 ns/iter (± 270) 0.97
es2015_duplicate_keys 62614 ns/iter (± 70) 63700 ns/iter (± 167) 0.98
es2015_parameters 78187 ns/iter (± 164) 79293 ns/iter (± 118) 0.99
es2015_fn_name 65771 ns/iter (± 652) 67068 ns/iter (± 597) 0.98
es2015_for_of 62769 ns/iter (± 84) 64388 ns/iter (± 197) 0.97
es2015_instanceof 62252 ns/iter (± 77) 63472 ns/iter (± 176) 0.98
es2015_shorthand_property 59982 ns/iter (± 67) 60688 ns/iter (± 66) 0.99
es2015_spread 59960 ns/iter (± 59) 60794 ns/iter (± 111) 0.99
es2015_sticky_regex 61262 ns/iter (± 41) 62257 ns/iter (± 146) 0.98
es2015_typeof_symbol 61241 ns/iter (± 73) 62137 ns/iter (± 143) 0.99
es/transform/baseline/base 51044 ns/iter (± 88) 51738 ns/iter (± 103) 0.99
es/transform/baseline/common_reserved_word 61319 ns/iter (± 82) 62332 ns/iter (± 112) 0.98
es/transform/baseline/common_typescript 166559 ns/iter (± 376) 155484 ns/iter (± 10505) 1.07
es/target/es3 165804 ns/iter (± 122) 168700 ns/iter (± 321) 0.98
es/target/es2015 602001 ns/iter (± 1149) 630900 ns/iter (± 902) 0.95
es/target/es2016 63778 ns/iter (± 76) 64994 ns/iter (± 72) 0.98
es/target/es2017 60452 ns/iter (± 45) 61618 ns/iter (± 114) 0.98
es/target/es2018 80204 ns/iter (± 73) 81371 ns/iter (± 133) 0.99
es/target/es2020 128441 ns/iter (± 115) 132505 ns/iter (± 276) 0.97
babelify-only 671031 ns/iter (± 1482) 675352 ns/iter (± 1283) 0.99
parse_and_babelify_angular 45899029 ns/iter (± 721333) 42497160 ns/iter (± 839117) 1.08
parse_and_babelify_backbone 5649894 ns/iter (± 161103) 5510516 ns/iter (± 63817) 1.03
parse_and_babelify_jquery 34577922 ns/iter (± 503362) 33558777 ns/iter (± 390548) 1.03
parse_and_babelify_jquery_mobile 59465545 ns/iter (± 1000709) 57724765 ns/iter (± 657042) 1.03
parse_and_babelify_mootools 35631671 ns/iter (± 383767) 35086916 ns/iter (± 460985) 1.02
parse_and_babelify_underscore 4392093 ns/iter (± 37491) 4392479 ns/iter (± 41487) 1.00
parse_and_babelify_yui 35439449 ns/iter (± 678210) 35193477 ns/iter (± 616657) 1.01
html/minify/document/css_spec 43375156 ns/iter (± 263807) 42873073 ns/iter (± 314228) 1.01
html/minify/document/github 17735859 ns/iter (± 345661) 17709914 ns/iter (± 40382) 1.00
html/minify/document/stackoverflow 15690098 ns/iter (± 42669) 15626896 ns/iter (± 44190) 1.00
html/minify/document_fragment/css_spec 41736730 ns/iter (± 358376) 41142457 ns/iter (± 180003) 1.01
html/minify/document_fragment/github 17083201 ns/iter (± 28754) 16812405 ns/iter (± 27576) 1.02
html/minify/document_fragment/stackoverflow 15338205 ns/iter (± 83196) 15154728 ns/iter (± 41787) 1.01
html/document/visitor/compare/clone 338078 ns/iter (± 2292) 337699 ns/iter (± 1998) 1.00
html/document/visitor/compare/visit_mut_span 365099 ns/iter (± 2153) 367891 ns/iter (± 1838) 0.99
html/document/visitor/compare/visit_mut_span_panic 370852 ns/iter (± 1539) 378343 ns/iter (± 2491) 0.98
html/document/visitor/compare/fold_span 401923 ns/iter (± 1878) 409718 ns/iter (± 2226) 0.98
html/document/visitor/compare/fold_span_panic 457738 ns/iter (± 1426) 465945 ns/iter (± 1786) 0.98
html/document_fragment/visitor/compare/clone 334144 ns/iter (± 1773) 336222 ns/iter (± 1710) 0.99
html/document_fragment/visitor/compare/visit_mut_span 367013 ns/iter (± 1406) 362833 ns/iter (± 2500) 1.01
html/document_fragment/visitor/compare/visit_mut_span_panic 370023 ns/iter (± 3071) 370407 ns/iter (± 1561) 1.00
html/document_fragment/visitor/compare/fold_span 399286 ns/iter (± 4586) 406743 ns/iter (± 1836) 0.98
html/document_fragment/visitor/compare/fold_span_panic 459892 ns/iter (± 1649) 460027 ns/iter (± 3150) 1.00
html/lexer/css_2021_spec 15550368 ns/iter (± 14915) 15554212 ns/iter (± 36572) 1.00
html/lexer/github_com_17_05_2022 6021430 ns/iter (± 4519) 6008585 ns/iter (± 9623) 1.00
html/lexer/stackoverflow_com_17_05_2022 5633894 ns/iter (± 12029) 5609862 ns/iter (± 4304) 1.00
html/parser/parser_document/css_2021_spec 26293747 ns/iter (± 192765) 26042056 ns/iter (± 146831) 1.01
html/parser/parser_document/github_com_17_05_2022 8770019 ns/iter (± 11304) 8800547 ns/iter (± 9337) 1.00
html/parser/parser_document/stackoverflow_com_17_05_2022 7714139 ns/iter (± 4384) 7757963 ns/iter (± 13928) 0.99
html/parser/parser_document_fragment/css_2021_spec 26797122 ns/iter (± 455780) 26173238 ns/iter (± 153488) 1.02
html/parser/parser_document_fragment/github_com_17_05_2022 8787531 ns/iter (± 16249) 8791442 ns/iter (± 10788) 1.00
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022 7742881 ns/iter (± 54971) 7724400 ns/iter (± 17119) 1.00

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

Please sign in to comment.