Skip to content

Commit 704b3ce

Browse files
alexander-akaitkdy1
andauthoredDec 13, 2022
feat(css/compat): Implement compat pass for media ranges (#6631)
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
1 parent d33fb7e commit 704b3ce

File tree

7 files changed

+1342
-1
lines changed

7 files changed

+1342
-1
lines changed
 

‎crates/swc_atoms/words.txt

+22
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ codebase
799799
col
800800
colgroup
801801
color
802+
color-index
802803
color-mix
803804
color-profile
804805
color-scheme
@@ -853,7 +854,10 @@ del
853854
delete
854855
desc
855856
details
857+
device-aspect-ratio
856858
device-cmyk
859+
device-height
860+
device-width
857861
dfn
858862
dialog
859863
diffuseConstant
@@ -1237,10 +1241,18 @@ math-shift
12371241
math-style
12381242
matrix
12391243
matrix3d
1244+
max-aspect-ratio
12401245
max-block-size
1246+
max-color
1247+
max-color-index
1248+
max-device-aspect-ratio
1249+
max-device-height
1250+
max-device-width
12411251
max-height
12421252
max-inline-size
12431253
max-lines
1254+
max-monochrome
1255+
max-resolution
12441256
max-width
12451257
maxlength
12461258
media
@@ -1251,9 +1263,17 @@ metadata
12511263
meter
12521264
mglyph
12531265
mi
1266+
min-aspect-ratio
12541267
min-block-size
1268+
min-color
1269+
min-color-index
1270+
min-device-aspect-ratio
1271+
min-device-height
1272+
min-device-width
12551273
min-height
12561274
min-inline-size
1275+
min-monochrome
1276+
min-resolution
12571277
min-width
12581278
missing-glyph
12591279
mix-blend-mode
@@ -1262,6 +1282,7 @@ mm
12621282
mn
12631283
mo
12641284
module
1285+
monochrome
12651286
mozmm
12661287
mpath
12671288
ms
@@ -1526,6 +1547,7 @@ requiredFeatures
15261547
requiredextensions
15271548
requiredfeatures
15281549
resize
1550+
resolution
15291551
return
15301552
revert
15311553
revert-layer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
use swc_atoms::js_word;
2+
use swc_common::DUMMY_SP;
3+
use swc_css_ast::{
4+
Dimension, Ident, MediaFeature, MediaFeatureName, MediaFeaturePlain, MediaFeatureRange,
5+
MediaFeatureRangeComparison, MediaFeatureRangeInterval, MediaFeatureValue,
6+
};
7+
8+
use crate::compiler::Compiler;
9+
10+
impl Compiler {
11+
pub(crate) fn get_legacy_media_feature(
12+
&mut self,
13+
n: &mut MediaFeature,
14+
) -> Option<(MediaFeature, Option<MediaFeature>)> {
15+
match n {
16+
MediaFeature::Range(MediaFeatureRange {
17+
span,
18+
left: box left,
19+
comparison,
20+
right: box right,
21+
..
22+
}) => {
23+
if let MediaFeatureValue::Ident(name) = &left {
24+
let name = match comparison {
25+
MediaFeatureRangeComparison::Lt | MediaFeatureRangeComparison::Le => {
26+
self.get_right_media_feature_name(name)
27+
}
28+
MediaFeatureRangeComparison::Eq => {
29+
Some(MediaFeatureName::Ident(name.clone()))
30+
}
31+
_ => self.get_left_media_feature_name(name),
32+
}?;
33+
34+
let original_value = right.clone();
35+
let value = match comparison {
36+
MediaFeatureRangeComparison::Lt => self.get_lt_value(original_value),
37+
MediaFeatureRangeComparison::Gt => self.get_gt_value(original_value),
38+
_ => Some(original_value),
39+
}?;
40+
41+
return Some((
42+
MediaFeature::Plain(MediaFeaturePlain {
43+
span: *span,
44+
name,
45+
value: Box::new(value),
46+
}),
47+
None,
48+
));
49+
} else if let MediaFeatureValue::Ident(name) = &right {
50+
let name = match comparison {
51+
MediaFeatureRangeComparison::Lt | MediaFeatureRangeComparison::Le => {
52+
self.get_left_media_feature_name(name)
53+
}
54+
MediaFeatureRangeComparison::Eq => {
55+
Some(MediaFeatureName::Ident(name.clone()))
56+
}
57+
_ => self.get_right_media_feature_name(name),
58+
}?;
59+
60+
let original_value = left.clone();
61+
let value = match comparison {
62+
MediaFeatureRangeComparison::Lt => self.get_gt_value(original_value),
63+
MediaFeatureRangeComparison::Gt => self.get_lt_value(original_value),
64+
_ => Some(original_value),
65+
}?;
66+
67+
return Some((
68+
MediaFeature::Plain(MediaFeaturePlain {
69+
span: *span,
70+
name,
71+
value: Box::new(value),
72+
}),
73+
None,
74+
));
75+
}
76+
}
77+
MediaFeature::RangeInterval(MediaFeatureRangeInterval {
78+
span,
79+
left: box left,
80+
left_comparison,
81+
name: MediaFeatureName::Ident(name),
82+
right: box right,
83+
right_comparison,
84+
..
85+
}) => {
86+
let left_name = match left_comparison {
87+
MediaFeatureRangeComparison::Gt | MediaFeatureRangeComparison::Ge => {
88+
self.get_right_media_feature_name(name)
89+
}
90+
_ => self.get_left_media_feature_name(name),
91+
}?;
92+
93+
let left_value = match left_comparison {
94+
MediaFeatureRangeComparison::Lt => self.get_gt_value(left.clone()),
95+
MediaFeatureRangeComparison::Gt => self.get_lt_value(left.clone()),
96+
_ => Some(left.clone()),
97+
}?;
98+
99+
let left = MediaFeature::Plain(MediaFeaturePlain {
100+
span: *span,
101+
name: left_name,
102+
value: Box::new(left_value),
103+
});
104+
105+
let right_name = match right_comparison {
106+
MediaFeatureRangeComparison::Gt | MediaFeatureRangeComparison::Ge => {
107+
self.get_left_media_feature_name(name)
108+
}
109+
_ => self.get_right_media_feature_name(name),
110+
}?;
111+
112+
let right_value = match right_comparison {
113+
MediaFeatureRangeComparison::Lt => self.get_lt_value(right.clone()),
114+
MediaFeatureRangeComparison::Gt => self.get_gt_value(right.clone()),
115+
_ => Some(right.clone()),
116+
}?;
117+
118+
let right = MediaFeature::Plain(MediaFeaturePlain {
119+
span: *span,
120+
name: right_name,
121+
value: Box::new(right_value),
122+
});
123+
124+
return Some((left, Some(right)));
125+
}
126+
_ => {}
127+
}
128+
129+
None
130+
}
131+
132+
fn get_left_media_feature_name(&self, name: &Ident) -> Option<MediaFeatureName> {
133+
let value = match name.value {
134+
js_word!("width") => js_word!("min-width"),
135+
js_word!("height") => js_word!("min-height"),
136+
js_word!("device-width") => js_word!("min-device-width"),
137+
js_word!("device-height") => js_word!("min-device-height"),
138+
js_word!("aspect-ratio") => js_word!("min-aspect-ratio"),
139+
js_word!("device-aspect-ratio") => js_word!("min-device-aspect-ratio"),
140+
js_word!("color") => js_word!("min-color"),
141+
js_word!("color-index") => js_word!("min-color-index"),
142+
js_word!("monochrome") => js_word!("min-monochrome"),
143+
js_word!("resolution") => js_word!("min-resolution"),
144+
_ => return None,
145+
};
146+
147+
Some(MediaFeatureName::Ident(Ident {
148+
span: DUMMY_SP,
149+
value,
150+
raw: None,
151+
}))
152+
}
153+
154+
fn get_right_media_feature_name(&self, name: &Ident) -> Option<MediaFeatureName> {
155+
let value = match name.value {
156+
js_word!("width") => js_word!("max-width"),
157+
js_word!("height") => js_word!("max-height"),
158+
js_word!("device-width") => js_word!("max-device-width"),
159+
js_word!("device-height") => js_word!("max-device-height"),
160+
js_word!("aspect-ratio") => js_word!("max-aspect-ratio"),
161+
js_word!("device-aspect-ratio") => js_word!("max-device-aspect-ratio"),
162+
js_word!("color") => js_word!("max-color"),
163+
js_word!("color-index") => js_word!("max-color-index"),
164+
js_word!("monochrome") => js_word!("max-monochrome"),
165+
js_word!("resolution") => js_word!("max-resolution"),
166+
_ => return None,
167+
};
168+
169+
Some(MediaFeatureName::Ident(Ident {
170+
span: DUMMY_SP,
171+
value,
172+
raw: None,
173+
}))
174+
}
175+
176+
fn get_lt_value(&self, mut value: MediaFeatureValue) -> Option<MediaFeatureValue> {
177+
match &mut value {
178+
MediaFeatureValue::Number(number) => {
179+
number.value -= 1.0;
180+
number.raw = None;
181+
182+
Some(value)
183+
}
184+
MediaFeatureValue::Dimension(dimension) => {
185+
match dimension {
186+
Dimension::Length(length) => {
187+
length.value.value -= 0.001;
188+
length.value.raw = None;
189+
}
190+
_ => {
191+
return None;
192+
}
193+
}
194+
195+
Some(value)
196+
}
197+
MediaFeatureValue::Ratio(ration) => {
198+
ration.left.value -= 0.001;
199+
ration.left.raw = None;
200+
201+
Some(value)
202+
}
203+
_ => None,
204+
}
205+
}
206+
207+
fn get_gt_value(&self, mut value: MediaFeatureValue) -> Option<MediaFeatureValue> {
208+
match &mut value {
209+
MediaFeatureValue::Number(number) => {
210+
number.value += 1.0;
211+
number.raw = None;
212+
213+
Some(value)
214+
}
215+
MediaFeatureValue::Dimension(dimension) => {
216+
match dimension {
217+
Dimension::Length(length) => {
218+
length.value.value += 0.001;
219+
length.value.raw = None;
220+
}
221+
_ => {
222+
return None;
223+
}
224+
}
225+
226+
Some(value)
227+
}
228+
MediaFeatureValue::Ratio(ration) => {
229+
ration.left.value += 0.001;
230+
ration.left.raw = None;
231+
232+
Some(value)
233+
}
234+
_ => None,
235+
}
236+
}
237+
}

‎crates/swc_css_compat/src/compiler/mod.rs

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
use swc_css_ast::{AtRule, MediaCondition, MediaConditionWithoutOr, MediaQuery, Rule};
1+
use swc_common::{Spanned, DUMMY_SP};
2+
use swc_css_ast::{
3+
AtRule, MediaAnd, MediaCondition, MediaConditionAllType, MediaConditionWithoutOr,
4+
MediaInParens, MediaQuery, Rule,
5+
};
26
use swc_css_visit::{VisitMut, VisitMutWith};
37

48
use self::custom_media::CustomMediaHandler;
59
use crate::feature::Features;
610

711
mod custom_media;
12+
mod media_query_ranges;
813

914
/// Compiles a modern CSS file to a CSS file which works with old browsers.
1015
#[derive(Debug)]
@@ -69,4 +74,35 @@ impl VisitMut for Compiler {
6974
self.custom_media.process_rules(n);
7075
}
7176
}
77+
78+
fn visit_mut_media_in_parens(&mut self, n: &mut MediaInParens) {
79+
n.visit_mut_children_with(self);
80+
81+
if self.c.process.contains(Features::MEDIA_QUERY_RANGES) {
82+
if let MediaInParens::Feature(media_feature) = n {
83+
if let Some(legacy_media_feature) = self.get_legacy_media_feature(media_feature) {
84+
match legacy_media_feature {
85+
(legacy_media_feature, None) => {
86+
*media_feature = Box::new(legacy_media_feature);
87+
}
88+
(left, Some(right)) => {
89+
*n = MediaInParens::MediaCondition(MediaCondition {
90+
span: n.span(),
91+
conditions: vec![
92+
MediaConditionAllType::MediaInParens(*Box::new(
93+
MediaInParens::Feature(Box::new(left)),
94+
)),
95+
MediaConditionAllType::And(MediaAnd {
96+
span: DUMMY_SP,
97+
keyword: None,
98+
condition: MediaInParens::Feature(Box::new(right)),
99+
}),
100+
],
101+
});
102+
}
103+
}
104+
}
105+
}
106+
}
107+
}
72108
}

‎crates/swc_css_compat/src/feature.rs

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ bitflags! {
44
pub struct Features: u64 {
55
const NESTING = 1 << 0;
66
const CUSTOM_MEDIA = 1 << 1;
7+
const MEDIA_QUERY_RANGES = 1 << 2;
78
}
89
}

‎crates/swc_css_compat/tests/fixture.rs

+22
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,25 @@ fn test_custom_media_query(input: PathBuf) {
103103
})
104104
.unwrap();
105105
}
106+
107+
#[testing::fixture("tests/media-query-ranges/**/*.css", exclude("expect.css"))]
108+
fn test_media_query_ranges(input: PathBuf) {
109+
let output = input.with_extension("expect.css");
110+
111+
testing::run_test(false, |cm, _| {
112+
//
113+
let fm = cm.load_file(&input).unwrap();
114+
let mut ss = parse_stylesheet(&fm);
115+
116+
ss.visit_mut_with(&mut Compiler::new(Config {
117+
process: Features::MEDIA_QUERY_RANGES,
118+
}));
119+
120+
let s = print_stylesheet(&ss);
121+
122+
NormalizedOutput::from(s).compare_to_file(&output).unwrap();
123+
124+
Ok(())
125+
})
126+
.unwrap();
127+
}

‎crates/swc_css_compat/tests/media-query-ranges/input.css

+466
Large diffs are not rendered by default.

‎crates/swc_css_compat/tests/media-query-ranges/input.expect.css

+557
Large diffs are not rendered by default.

1 commit comments

Comments
 (1)

github-actions[bot] commented on Dec 13, 2022

@github-actions[bot]

Benchmark

Benchmark suite Current: 704b3ce Previous: 08ccb83 Ratio
es/full/bugs-1 289305 ns/iter (± 12314) 303776 ns/iter (± 6865) 0.95
es/full/minify/libraries/antd 1622302807 ns/iter (± 19009959) 1845162605 ns/iter (± 16448442) 0.88
es/full/minify/libraries/d3 328954115 ns/iter (± 4369289) 370059442 ns/iter (± 7252804) 0.89
es/full/minify/libraries/echarts 1376411860 ns/iter (± 10905624) 1530883062 ns/iter (± 18861638) 0.90
es/full/minify/libraries/jquery 93289499 ns/iter (± 2608491) 94478493 ns/iter (± 1267837) 0.99
es/full/minify/libraries/lodash 109401411 ns/iter (± 1914471) 115256820 ns/iter (± 1840597) 0.95
es/full/minify/libraries/moment 51852104 ns/iter (± 743712) 55661934 ns/iter (± 872357) 0.93
es/full/minify/libraries/react 19184968 ns/iter (± 98360) 20413697 ns/iter (± 166351) 0.94
es/full/minify/libraries/terser 245370800 ns/iter (± 1830200) 286097305 ns/iter (± 5769196) 0.86
es/full/minify/libraries/three 443480259 ns/iter (± 5054937) 526876309 ns/iter (± 9893060) 0.84
es/full/minify/libraries/typescript 3051773069 ns/iter (± 22100513) 3434112004 ns/iter (± 22644063) 0.89
es/full/minify/libraries/victory 650799246 ns/iter (± 13887793) 793423172 ns/iter (± 12500539) 0.82
es/full/minify/libraries/vue 130533571 ns/iter (± 1249151) 144916683 ns/iter (± 3161580) 0.90
es/full/codegen/es3 27677 ns/iter (± 53) 27325 ns/iter (± 53) 1.01
es/full/codegen/es5 27676 ns/iter (± 79) 27314 ns/iter (± 81) 1.01
es/full/codegen/es2015 27699 ns/iter (± 28) 27312 ns/iter (± 59) 1.01
es/full/codegen/es2016 27697 ns/iter (± 46) 27320 ns/iter (± 58) 1.01
es/full/codegen/es2017 27706 ns/iter (± 46) 27317 ns/iter (± 49) 1.01
es/full/codegen/es2018 27696 ns/iter (± 26) 27271 ns/iter (± 63) 1.02
es/full/codegen/es2019 27684 ns/iter (± 32) 27279 ns/iter (± 67) 1.01
es/full/codegen/es2020 27720 ns/iter (± 61) 27340 ns/iter (± 75) 1.01
es/full/all/es3 170946460 ns/iter (± 1794723) 170147847 ns/iter (± 5045637) 1.00
es/full/all/es5 161460722 ns/iter (± 3566650) 160743500 ns/iter (± 4086110) 1.00
es/full/all/es2015 119706380 ns/iter (± 2217628) 120176485 ns/iter (± 1120410) 1.00
es/full/all/es2016 118387573 ns/iter (± 738347) 119818889 ns/iter (± 1210850) 0.99
es/full/all/es2017 118220181 ns/iter (± 724906) 118660706 ns/iter (± 1826616) 1.00
es/full/all/es2018 116217264 ns/iter (± 1110681) 117898322 ns/iter (± 3913535) 0.99
es/full/all/es2019 114686202 ns/iter (± 658838) 117055186 ns/iter (± 1648719) 0.98
es/full/all/es2020 110257701 ns/iter (± 1023928) 112595176 ns/iter (± 2851320) 0.98
es/full/parser 517593 ns/iter (± 7122) 507700 ns/iter (± 8607) 1.02
es/full/base/fixer 21989 ns/iter (± 25) 21861 ns/iter (± 32) 1.01
es/full/base/resolver_and_hygiene 77925 ns/iter (± 75) 78474 ns/iter (± 124) 0.99
serialization of ast node 121 ns/iter (± 0) 121 ns/iter (± 0) 1
serialization of serde 125 ns/iter (± 0) 125 ns/iter (± 0) 1
css/minify/libraries/bootstrap 26807848 ns/iter (± 98572) 27362226 ns/iter (± 178395) 0.98
css/visitor/compare/clone 2046545 ns/iter (± 5051) 2069058 ns/iter (± 11886) 0.99
css/visitor/compare/visit_mut_span 2235681 ns/iter (± 6856) 2245462 ns/iter (± 3387) 1.00
css/visitor/compare/visit_mut_span_panic 2287660 ns/iter (± 5254) 2305180 ns/iter (± 9472) 0.99
css/visitor/compare/fold_span 2955804 ns/iter (± 21403) 2956698 ns/iter (± 17474) 1.00
css/visitor/compare/fold_span_panic 3095060 ns/iter (± 15554) 3103785 ns/iter (± 11470) 1.00
css/lexer/bootstrap_5_1_3 5180695 ns/iter (± 1188) 5186733 ns/iter (± 1032) 1.00
css/lexer/foundation_6_7_4 4402033 ns/iter (± 12929) 4399456 ns/iter (± 1446) 1.00
css/lexer/tailwind_3_1_1 826881 ns/iter (± 211) 824374 ns/iter (± 3616) 1.00
css/parser/bootstrap_5_1_3 20570424 ns/iter (± 28167) 21005076 ns/iter (± 102899) 0.98
css/parser/foundation_6_7_4 16443760 ns/iter (± 26591) 16600088 ns/iter (± 43725) 0.99
css/parser/tailwind_3_1_1 3184246 ns/iter (± 5797) 3187882 ns/iter (± 5613) 1.00
es/codegen/colors 330378 ns/iter (± 185496) 323882 ns/iter (± 181451) 1.02
es/codegen/large 1229344 ns/iter (± 624145) 1226113 ns/iter (± 635685) 1.00
es/codegen/with-parser/colors 46387 ns/iter (± 255) 46569 ns/iter (± 352) 1.00
es/codegen/with-parser/large 509405 ns/iter (± 1499) 514141 ns/iter (± 2456) 0.99
es/minify/libraries/antd 1405396649 ns/iter (± 31871365) 1578295459 ns/iter (± 13900468) 0.89
es/minify/libraries/d3 277343355 ns/iter (± 6661147) 306934144 ns/iter (± 3201295) 0.90
es/minify/libraries/echarts 1191004310 ns/iter (± 23064667) 1315471777 ns/iter (± 11384964) 0.91
es/minify/libraries/jquery 77287443 ns/iter (± 461727) 81760366 ns/iter (± 741435) 0.95
es/minify/libraries/lodash 95050907 ns/iter (± 854418) 101031919 ns/iter (± 1263705) 0.94
es/minify/libraries/moment 45173664 ns/iter (± 165873) 47106376 ns/iter (± 557651) 0.96
es/minify/libraries/react 16963008 ns/iter (± 77284) 17748840 ns/iter (± 191692) 0.96
es/minify/libraries/terser 210085598 ns/iter (± 1391481) 234843234 ns/iter (± 4232659) 0.89
es/minify/libraries/three 365826739 ns/iter (± 4855485) 437424574 ns/iter (± 6367977) 0.84
es/minify/libraries/typescript 2603519008 ns/iter (± 6880265) 2927844859 ns/iter (± 15472052) 0.89
es/minify/libraries/victory 538272194 ns/iter (± 8164739) 678363858 ns/iter (± 12476552) 0.79
es/minify/libraries/vue 116340863 ns/iter (± 724727) 123533815 ns/iter (± 1622976) 0.94
es/visitor/compare/clone 2413736 ns/iter (± 6014) 2401108 ns/iter (± 3629) 1.01
es/visitor/compare/visit_mut_span 2792102 ns/iter (± 5782) 2789884 ns/iter (± 10960) 1.00
es/visitor/compare/visit_mut_span_panic 2837517 ns/iter (± 7276) 2885309 ns/iter (± 17527) 0.98
es/visitor/compare/fold_span 3943033 ns/iter (± 7428) 4000155 ns/iter (± 16191) 0.99
es/visitor/compare/fold_span_panic 4043881 ns/iter (± 5293) 4151333 ns/iter (± 32541) 0.97
es/lexer/colors 17237 ns/iter (± 6) 17352 ns/iter (± 10) 0.99
es/lexer/angular 8192065 ns/iter (± 4174) 8223938 ns/iter (± 9606) 1.00
es/lexer/backbone 1067724 ns/iter (± 896) 1071251 ns/iter (± 344) 1.00
es/lexer/jquery 5921730 ns/iter (± 5857) 5940937 ns/iter (± 8797) 1.00
es/lexer/jquery mobile 9138154 ns/iter (± 6810) 9152546 ns/iter (± 3492) 1.00
es/lexer/mootools 4646015 ns/iter (± 2103) 4667370 ns/iter (± 2934) 1.00
es/lexer/underscore 889562 ns/iter (± 340) 891852 ns/iter (± 350) 1.00
es/lexer/three 27737815 ns/iter (± 13578) 27829811 ns/iter (± 12970) 1.00
es/lexer/yui 5032806 ns/iter (± 5999) 5052587 ns/iter (± 2525) 1.00
es/parser/colors 30190 ns/iter (± 134) 30814 ns/iter (± 166) 0.98
es/parser/angular 15250691 ns/iter (± 114667) 16018576 ns/iter (± 150822) 0.95
es/parser/backbone 2285163 ns/iter (± 32217) 2342028 ns/iter (± 15425) 0.98
es/parser/jquery 12370365 ns/iter (± 52142) 12907197 ns/iter (± 190091) 0.96
es/parser/jquery mobile 19544362 ns/iter (± 305575) 21041204 ns/iter (± 388575) 0.93
es/parser/mootools 9493215 ns/iter (± 23226) 9732033 ns/iter (± 71602) 0.98
es/parser/underscore 1944699 ns/iter (± 10591) 1973802 ns/iter (± 12370) 0.99
es/parser/three 56228395 ns/iter (± 785135) 61662985 ns/iter (± 193378) 0.91
es/parser/yui 9446312 ns/iter (± 51919) 9702513 ns/iter (± 102431) 0.97
es/preset-env/usage/builtin_type 140917 ns/iter (± 31529) 139647 ns/iter (± 31183) 1.01
es/preset-env/usage/property 21169 ns/iter (± 73) 21505 ns/iter (± 85) 0.98
es/resolver/typescript 108047755 ns/iter (± 1649249) 121649364 ns/iter (± 2279026) 0.89
es/fixer/typescript 87924717 ns/iter (± 2771281) 99532274 ns/iter (± 1054082) 0.88
es/hygiene/typescript 165722714 ns/iter (± 1718036) 197181350 ns/iter (± 1076569) 0.84
es/resolver_with_hygiene/typescript 298210181 ns/iter (± 1830802) 335454496 ns/iter (± 3723323) 0.89
es/visitor/base-perf/module_clone 74349 ns/iter (± 681) 74009 ns/iter (± 1169) 1.00
es/visitor/base-perf/fold_empty 86393 ns/iter (± 1220) 85032 ns/iter (± 1279) 1.02
es/visitor/base-perf/fold_noop_impl_all 86102 ns/iter (± 1004) 85040 ns/iter (± 525) 1.01
es/visitor/base-perf/fold_noop_impl_vec 86233 ns/iter (± 960) 85954 ns/iter (± 1661) 1.00
es/visitor/base-perf/boxing_boxed_clone 54 ns/iter (± 0) 54 ns/iter (± 0) 1
es/visitor/base-perf/boxing_unboxed_clone 58 ns/iter (± 0) 58 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 99 ns/iter (± 0) 99 ns/iter (± 0) 1
es/visitor/base-perf/boxing_unboxed 100 ns/iter (± 0) 100 ns/iter (± 0) 1
es/visitor/base-perf/visit_contains_this 3523 ns/iter (± 79) 3483 ns/iter (± 63) 1.01
es/base/parallel/resolver/typescript 4847292128 ns/iter (± 258993526) 6124939990 ns/iter (± 385003413) 0.79
es/base/parallel/hygiene/typescript 1970960140 ns/iter (± 35435056) 2259058215 ns/iter (± 44524735) 0.87
misc/visitors/time-complexity/time 5 95 ns/iter (± 1) 92 ns/iter (± 0) 1.03
misc/visitors/time-complexity/time 10 301 ns/iter (± 0) 304 ns/iter (± 8) 0.99
misc/visitors/time-complexity/time 15 625 ns/iter (± 0) 619 ns/iter (± 5) 1.01
misc/visitors/time-complexity/time 20 1162 ns/iter (± 2) 1124 ns/iter (± 1) 1.03
misc/visitors/time-complexity/time 40 6118 ns/iter (± 3) 5963 ns/iter (± 19) 1.03
misc/visitors/time-complexity/time 60 15481 ns/iter (± 44) 15265 ns/iter (± 86) 1.01
es/full-target/es2016 187370 ns/iter (± 355) 187839 ns/iter (± 799) 1.00
es/full-target/es2017 180211 ns/iter (± 362) 181522 ns/iter (± 633) 0.99
es/full-target/es2018 169654 ns/iter (± 621) 170964 ns/iter (± 726) 0.99
es2020_nullish_coalescing 65508 ns/iter (± 111) 65730 ns/iter (± 106) 1.00
es2020_optional_chaining 93396 ns/iter (± 262) 94476 ns/iter (± 243) 0.99
es2022_class_properties 91831 ns/iter (± 141) 92362 ns/iter (± 147) 0.99
es2018_object_rest_spread 69953 ns/iter (± 86) 70534 ns/iter (± 100) 0.99
es2019_optional_catch_binding 59700 ns/iter (± 136) 60099 ns/iter (± 124) 0.99
es2017_async_to_generator 60061 ns/iter (± 113) 60505 ns/iter (± 104) 0.99
es2016_exponentiation 63406 ns/iter (± 177) 63589 ns/iter (± 113) 1.00
es2015_arrow 68492 ns/iter (± 157) 69201 ns/iter (± 228) 0.99
es2015_block_scoped_fn 64735 ns/iter (± 159) 64875 ns/iter (± 100) 1.00
es2015_block_scoping 136365 ns/iter (± 11584) 139942 ns/iter (± 9785) 0.97
es2015_classes 113636 ns/iter (± 348) 114948 ns/iter (± 517) 0.99
es2015_computed_props 59910 ns/iter (± 86) 59977 ns/iter (± 95) 1.00
es2015_destructuring 114004 ns/iter (± 245) 114783 ns/iter (± 232) 0.99
es2015_duplicate_keys 62178 ns/iter (± 102) 62683 ns/iter (± 74) 0.99
es2015_parameters 77926 ns/iter (± 61) 78534 ns/iter (± 136) 0.99
es2015_fn_name 64904 ns/iter (± 444) 65751 ns/iter (± 619) 0.99
es2015_for_of 62624 ns/iter (± 90) 63056 ns/iter (± 70) 0.99
es2015_instanceof 61591 ns/iter (± 104) 62038 ns/iter (± 114) 0.99
es2015_shorthand_property 59920 ns/iter (± 95) 60235 ns/iter (± 128) 0.99
es2015_spread 59514 ns/iter (± 89) 60009 ns/iter (± 109) 0.99
es2015_sticky_regex 60392 ns/iter (± 123) 60882 ns/iter (± 95) 0.99
es2015_typeof_symbol 60884 ns/iter (± 70) 61171 ns/iter (± 88) 1.00
es/transform/baseline/base 50217 ns/iter (± 88) 50687 ns/iter (± 117) 0.99
es/transform/baseline/common_reserved_word 61157 ns/iter (± 107) 61466 ns/iter (± 158) 0.99
es/transform/baseline/common_typescript 141351 ns/iter (± 4856) 142065 ns/iter (± 1364) 0.99
es/target/es3 167094 ns/iter (± 2311) 169408 ns/iter (± 184) 0.99
es/target/es2015 622494 ns/iter (± 1558) 627439 ns/iter (± 1340) 0.99
es/target/es2016 63544 ns/iter (± 109) 63736 ns/iter (± 129) 1.00
es/target/es2017 60209 ns/iter (± 209) 60764 ns/iter (± 104) 0.99
es/target/es2018 80097 ns/iter (± 77) 80843 ns/iter (± 45) 0.99
es/target/es2020 130896 ns/iter (± 198) 131677 ns/iter (± 227) 0.99
babelify-only 660212 ns/iter (± 1003) 662431 ns/iter (± 933) 1.00
parse_and_babelify_angular 40574355 ns/iter (± 281420) 43547409 ns/iter (± 403685) 0.93
parse_and_babelify_backbone 5154974 ns/iter (± 25555) 5542062 ns/iter (± 85907) 0.93
parse_and_babelify_jquery 30461489 ns/iter (± 207846) 33674568 ns/iter (± 752682) 0.90
parse_and_babelify_jquery_mobile 51544600 ns/iter (± 800460) 58952023 ns/iter (± 1396704) 0.87
parse_and_babelify_mootools 31290980 ns/iter (± 804775) 34709569 ns/iter (± 673116) 0.90
parse_and_babelify_underscore 4174321 ns/iter (± 14836) 4331184 ns/iter (± 37991) 0.96
parse_and_babelify_yui 30006111 ns/iter (± 193233) 34433015 ns/iter (± 510403) 0.87
html/minify/document/css_spec 40383288 ns/iter (± 110318) 42307283 ns/iter (± 222701) 0.95
html/minify/document/github 17178034 ns/iter (± 26727) 17613077 ns/iter (± 49626) 0.98
html/minify/document/stackoverflow 15340888 ns/iter (± 25553) 15742218 ns/iter (± 76436) 0.97
html/minify/document_fragment/css_spec 38790304 ns/iter (± 92670) 41250042 ns/iter (± 318346) 0.94
html/minify/document_fragment/github 16542536 ns/iter (± 12901) 16851872 ns/iter (± 51625) 0.98
html/minify/document_fragment/stackoverflow 14956123 ns/iter (± 17015) 15426012 ns/iter (± 99063) 0.97
html/document/visitor/compare/clone 336403 ns/iter (± 2050) 341367 ns/iter (± 2263) 0.99
html/document/visitor/compare/visit_mut_span 365025 ns/iter (± 2006) 364488 ns/iter (± 1762) 1.00
html/document/visitor/compare/visit_mut_span_panic 372259 ns/iter (± 1820) 380599 ns/iter (± 1515) 0.98
html/document/visitor/compare/fold_span 409518 ns/iter (± 2678) 407655 ns/iter (± 1735) 1.00
html/document/visitor/compare/fold_span_panic 462525 ns/iter (± 2182) 464198 ns/iter (± 2580) 1.00
html/document_fragment/visitor/compare/clone 330841 ns/iter (± 1648) 342110 ns/iter (± 2074) 0.97
html/document_fragment/visitor/compare/visit_mut_span 361405 ns/iter (± 2138) 369967 ns/iter (± 1857) 0.98
html/document_fragment/visitor/compare/visit_mut_span_panic 367437 ns/iter (± 2033) 372630 ns/iter (± 2714) 0.99
html/document_fragment/visitor/compare/fold_span 397938 ns/iter (± 1372) 404026 ns/iter (± 1990) 0.98
html/document_fragment/visitor/compare/fold_span_panic 454007 ns/iter (± 1765) 456174 ns/iter (± 2130) 1.00
html/lexer/css_2021_spec 15587662 ns/iter (± 6748) 15604431 ns/iter (± 17936) 1.00
html/lexer/github_com_17_05_2022 6054534 ns/iter (± 2116) 6051207 ns/iter (± 2323) 1.00
html/lexer/stackoverflow_com_17_05_2022 5652681 ns/iter (± 3808) 5656688 ns/iter (± 2702) 1.00
html/parser/parser_document/css_2021_spec 25374873 ns/iter (± 85658) 26217067 ns/iter (± 215392) 0.97
html/parser/parser_document/github_com_17_05_2022 8777002 ns/iter (± 4244) 8747196 ns/iter (± 13850) 1.00
html/parser/parser_document/stackoverflow_com_17_05_2022 7723362 ns/iter (± 3189) 7698225 ns/iter (± 9427) 1.00
html/parser/parser_document_fragment/css_2021_spec 25612188 ns/iter (± 108809) 26737710 ns/iter (± 372956) 0.96
html/parser/parser_document_fragment/github_com_17_05_2022 8798200 ns/iter (± 4771) 8788655 ns/iter (± 26975) 1.00
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022 7759300 ns/iter (± 8457) 7732552 ns/iter (± 5161) 1.00

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

Please sign in to comment.