Skip to content

Commit 82bd5c2

Browse files
authoredJan 16, 2023
feat(es/renamer): Rename synthesized identifiers even on eval (#6818)
**Related issue:** - Closes #5068.
1 parent a5707ae commit 82bd5c2

File tree

15 files changed

+253
-36
lines changed

15 files changed

+253
-36
lines changed
 

‎crates/swc/src/builder.rs

+77-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use swc_common::{
1212
util::take::Take,
1313
FileName, Mark, SourceMap,
1414
};
15-
use swc_ecma_ast::{EsVersion, Module};
15+
use swc_ecma_ast::{EsVersion, Module, Script};
1616
use swc_ecma_minifier::option::{terser::TerserTopLevelOptions, MinifyOptions};
1717
use swc_ecma_parser::Syntax;
1818
use swc_ecma_transforms::{
@@ -351,11 +351,13 @@ impl<'a, 'b, P: swc_ecma_visit::Fold> PassBuilder<'a, 'b, P> {
351351
options: self.minify,
352352
cm: self.cm.clone(),
353353
comments: comments.cloned(),
354-
unresolved_mark: self.unresolved_mark,
355354
top_level_mark: self.top_level_mark,
356355
}),
357356
Optional::new(
358-
hygiene_with_config(self.hygiene.clone().unwrap_or_default()),
357+
hygiene_with_config(swc_ecma_transforms_base::hygiene::Config {
358+
top_level_mark: self.top_level_mark,
359+
..self.hygiene.clone().unwrap_or_default()
360+
}),
359361
self.hygiene.is_some() && !is_mangler_enabled
360362
),
361363
Optional::new(fixer(comments.map(|v| v as &dyn Comments)), self.fixer),
@@ -367,7 +369,6 @@ struct MinifierPass {
367369
options: Option<JsMinifyOptions>,
368370
cm: Lrc<SourceMap>,
369371
comments: Option<SingleThreadedComments>,
370-
unresolved_mark: Mark,
371372
top_level_mark: Mark,
372373
}
373374

@@ -408,13 +409,18 @@ impl VisitMut for MinifierPass {
408409
return;
409410
}
410411

411-
m.visit_mut_with(&mut hygiene());
412-
m.visit_mut_with(&mut resolver(
413-
self.unresolved_mark,
414-
self.top_level_mark,
415-
false,
412+
m.visit_mut_with(&mut hygiene_with_config(
413+
swc_ecma_transforms_base::hygiene::Config {
414+
top_level_mark: self.top_level_mark,
415+
..Default::default()
416+
},
416417
));
417418

419+
let unresolved_mark = Mark::new();
420+
let top_level_mark = Mark::new();
421+
422+
m.visit_mut_with(&mut resolver(unresolved_mark, top_level_mark, false));
423+
418424
m.map_with_mut(|m| {
419425
swc_ecma_minifier::optimize(
420426
m.into(),
@@ -423,14 +429,74 @@ impl VisitMut for MinifierPass {
423429
None,
424430
&opts,
425431
&swc_ecma_minifier::option::ExtraOptions {
426-
unresolved_mark: self.unresolved_mark,
427-
top_level_mark: self.top_level_mark,
432+
unresolved_mark,
433+
top_level_mark,
428434
},
429435
)
430436
.expect_module()
431437
})
432438
}
433439
}
440+
441+
fn visit_mut_script(&mut self, m: &mut Script) {
442+
if let Some(options) = &self.options {
443+
let opts = MinifyOptions {
444+
compress: options
445+
.compress
446+
.clone()
447+
.unwrap_as_option(|default| match default {
448+
Some(true) => Some(Default::default()),
449+
_ => None,
450+
})
451+
.map(|mut v| {
452+
if v.const_to_let.is_none() {
453+
v.const_to_let = Some(true);
454+
}
455+
456+
v.into_config(self.cm.clone())
457+
}),
458+
mangle: options
459+
.mangle
460+
.clone()
461+
.unwrap_as_option(|default| match default {
462+
Some(true) => Some(Default::default()),
463+
_ => None,
464+
}),
465+
..Default::default()
466+
};
467+
468+
if opts.compress.is_none() && opts.mangle.is_none() {
469+
return;
470+
}
471+
472+
m.visit_mut_with(&mut hygiene_with_config(
473+
swc_ecma_transforms_base::hygiene::Config {
474+
top_level_mark: self.top_level_mark,
475+
..Default::default()
476+
},
477+
));
478+
479+
let unresolved_mark = Mark::new();
480+
let top_level_mark = Mark::new();
481+
482+
m.visit_mut_with(&mut resolver(unresolved_mark, top_level_mark, false));
483+
484+
m.map_with_mut(|m| {
485+
swc_ecma_minifier::optimize(
486+
m.into(),
487+
self.cm.clone(),
488+
self.comments.as_ref().map(|v| v as &dyn Comments),
489+
None,
490+
&opts,
491+
&swc_ecma_minifier::option::ExtraOptions {
492+
unresolved_mark,
493+
top_level_mark,
494+
},
495+
)
496+
.expect_script()
497+
})
498+
}
499+
}
434500
}
435501

436502
fn should_enable(target: EsVersion, feature: EsVersion) -> bool {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "typescript",
5+
"tsx": true
6+
},
7+
"target": "es5",
8+
"loose": false,
9+
"minify": {
10+
"compress": false,
11+
"mangle": false
12+
}
13+
},
14+
"module": {
15+
"type": "es6"
16+
},
17+
"minify": false,
18+
"isModule": true
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import styled from 'styled-components';
2+
3+
const C1 = styled.div`
4+
position: absolute;
5+
`;
6+
7+
const C2 = styled.div`
8+
position: absolute;
9+
`;
10+
11+
const debug = eval('');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import _tagged_template_literal from "@swc/helpers/src/_tagged_template_literal.mjs";
2+
function _templateObject() {
3+
var data = _tagged_template_literal([
4+
"\n position: absolute;\n"
5+
]);
6+
_templateObject = function _templateObject() {
7+
return data;
8+
};
9+
return data;
10+
}
11+
function _templateObject1() {
12+
var data = _tagged_template_literal([
13+
"\n position: absolute;\n"
14+
]);
15+
_templateObject1 = function _templateObject1() {
16+
return data;
17+
};
18+
return data;
19+
}
20+
import styled from "styled-components";
21+
var C1 = styled.div(_templateObject());
22+
var C2 = styled.div(_templateObject1());
23+
var debug = eval("");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "typescript",
5+
"tsx": true
6+
},
7+
"target": "es5",
8+
"loose": false,
9+
"minify": {
10+
"compress": false,
11+
"mangle": true
12+
}
13+
},
14+
"module": {
15+
"type": "es6"
16+
},
17+
"minify": false,
18+
"isModule": true
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import styled from 'styled-components';
2+
3+
const C1 = styled.div`
4+
position: absolute;
5+
`;
6+
7+
const C2 = styled.div`
8+
position: absolute;
9+
`;
10+
11+
const debug = eval('');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import _tagged_template_literal from "@swc/helpers/src/_tagged_template_literal.mjs";
2+
function _templateObject() {
3+
var n = _tagged_template_literal([
4+
"\n position: absolute;\n"
5+
]);
6+
_templateObject = function r() {
7+
return n;
8+
};
9+
return n;
10+
}
11+
function _templateObject1() {
12+
var n = _tagged_template_literal([
13+
"\n position: absolute;\n"
14+
]);
15+
_templateObject1 = function r() {
16+
return n;
17+
};
18+
return n;
19+
}
20+
import styled from "styled-components";
21+
var C1 = styled.div(_templateObject());
22+
var C2 = styled.div(_templateObject1());
23+
var debug = eval("");

‎crates/swc_ecma_minifier/src/lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,12 @@ pub fn optimize(
274274
)
275275
.compile();
276276

277-
n.visit_mut_with(&mut name_mangler(mangle.clone(), preserved, chars));
277+
n.visit_mut_with(&mut name_mangler(
278+
mangle.clone(),
279+
preserved,
280+
chars,
281+
extra.top_level_mark,
282+
));
278283

279284
if let Some(property_mangle_options) = &mangle.props {
280285
mangle_properties(&mut n, &module_info, property_mangle_options.clone(), chars);

‎crates/swc_ecma_minifier/src/pass/mangle_names/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_hash::{FxHashMap, FxHashSet};
22
use swc_atoms::JsWord;
3-
use swc_common::chain;
3+
use swc_common::{chain, Mark};
44
use swc_ecma_ast::{Module, *};
55
use swc_ecma_transforms_base::rename::{renamer, Renamer};
66
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
@@ -15,6 +15,7 @@ pub(crate) fn name_mangler(
1515
options: MangleOptions,
1616
preserved: FxHashSet<Id>,
1717
chars: Base54Chars,
18+
top_level_mark: Mark,
1819
) -> impl VisitMut {
1920
chain!(
2021
LabelMangler {
@@ -27,6 +28,7 @@ pub(crate) fn name_mangler(
2728
swc_ecma_transforms_base::hygiene::Config {
2829
keep_class_names: options.keep_class_names,
2930
safari_10: options.safari10,
31+
top_level_mark
3032
},
3133
ManglingRenamer { chars, preserved }
3234
)

‎crates/swc_ecma_transforms_base/src/hygiene/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use swc_common::chain;
1+
use swc_common::{chain, Mark};
22
use swc_ecma_ast::*;
33
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut};
44

@@ -15,6 +15,10 @@ pub struct Config {
1515

1616
/// If true, the bug of safari 10 is avoided.
1717
pub safari_10: bool,
18+
19+
/// The marks derived from this marks will treated as `specified by user`
20+
/// and other marks will be treated as `generated by swc`.
21+
pub top_level_mark: Mark,
1822
}
1923

2024
/// See [hygiene_with_config] for doc. Creates a `hygiene` pass with default

‎crates/swc_ecma_transforms_base/src/rename/analyzer/mod.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use swc_common::Mark;
12
use swc_ecma_ast::*;
23
use swc_ecma_visit::{noop_visit_type, Visit, VisitWith};
34

@@ -9,6 +10,11 @@ pub(super) mod scope;
910
#[derive(Debug, Default)]
1011
pub(super) struct Analyzer {
1112
pub safari_10: bool,
13+
/// If `eval` exists for the current scope, we only rename synthesized
14+
/// identifiers.
15+
pub has_eval: bool,
16+
/// The [Mark] which is parent of user-specified identifiers.
17+
pub top_level_mark: Mark,
1218

1319
pub is_pat_decl: bool,
1420
pub var_belong_to_fn_scope: bool,
@@ -25,12 +31,12 @@ impl Analyzer {
2531
if belong_to_fn_scope {
2632
match self.scope.kind {
2733
ScopeKind::Fn => {
28-
self.scope.add_decl(&id);
34+
self.scope.add_decl(&id, self.has_eval, self.top_level_mark);
2935
}
3036
ScopeKind::Block => self.hoisted_vars.push(id),
3137
}
3238
} else {
33-
self.scope.add_decl(&id);
39+
self.scope.add_decl(&id, self.has_eval, self.top_level_mark);
3440
}
3541
}
3642

@@ -45,14 +51,16 @@ impl Analyzer {
4551
{
4652
let mut v = Analyzer {
4753
safari_10: self.safari_10,
54+
has_eval: self.has_eval,
55+
top_level_mark: self.top_level_mark,
4856

57+
is_pat_decl: self.is_pat_decl,
58+
var_belong_to_fn_scope: false,
59+
in_catch_params: false,
4960
scope: Scope {
5061
kind,
5162
..Default::default()
5263
},
53-
is_pat_decl: self.is_pat_decl,
54-
var_belong_to_fn_scope: false,
55-
in_catch_params: false,
5664
hoisted_vars: Default::default(),
5765
};
5866

‎crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{
99
use rayon::prelude::*;
1010
use rustc_hash::FxHashSet;
1111
use swc_atoms::{js_word, JsWord};
12-
use swc_common::{collections::AHashMap, util::take::Take, SyntaxContext};
12+
use swc_common::{collections::AHashMap, util::take::Take, Mark, SyntaxContext};
1313
use swc_ecma_ast::*;
1414
use tracing::debug;
1515

@@ -81,13 +81,17 @@ pub(super) struct ScopeData {
8181
}
8282

8383
impl Scope {
84-
pub(super) fn add_decl(&mut self, id: &Id) {
84+
pub(super) fn add_decl(&mut self, id: &Id, has_eval: bool, top_level_mark: Mark) {
8585
if id.0 == js_word!("arguments") {
8686
return;
8787
}
8888

8989
self.data.all.insert(fast_id(id.clone()));
9090
if !self.data.queue.contains(id) {
91+
if has_eval && id.1.outer().is_descendant_of(top_level_mark) {
92+
return;
93+
}
94+
9195
self.data.queue.push(id.clone());
9296
}
9397
}

‎crates/swc_ecma_transforms_base/src/rename/mod.rs

+26-14
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ where
106106
node: &N,
107107
skip_one: bool,
108108
is_module_or_script: bool,
109+
has_eval: bool,
109110
) -> AHashMap<Id, JsWord>
110111
where
111112
N: VisitWith<IdCollector> + VisitWith<CustomBindingCollector<Id>>,
@@ -114,6 +115,9 @@ where
114115
let mut scope = {
115116
let mut v = Analyzer {
116117
safari_10: self.config.safari_10,
118+
has_eval,
119+
top_level_mark: self.config.top_level_mark,
120+
117121
..Default::default()
118122
};
119123
if skip_one {
@@ -178,7 +182,7 @@ macro_rules! unit {
178182
if contains_eval(n, true) {
179183
n.visit_mut_children_with(self);
180184
} else {
181-
let map = self.get_map(n, false, false);
185+
let map = self.get_map(n, false, false, false);
182186

183187
n.visit_mut_with(&mut rename_with_config(&map, self.config.clone()));
184188
}
@@ -190,7 +194,7 @@ macro_rules! unit {
190194
if contains_eval(n, true) {
191195
n.visit_mut_children_with(self);
192196
} else {
193-
let map = self.get_map(n, true, false);
197+
let map = self.get_map(n, true, false, false);
194198

195199
n.visit_mut_with(&mut rename_with_config(&map, self.config.clone()));
196200
}
@@ -228,25 +232,33 @@ where
228232
self.preserved = self.renamer.preserved_ids_for_module(m);
229233
self.unresolved = self.get_unresolved(m);
230234

231-
if contains_eval(m, true) {
232-
m.visit_mut_children_with(self);
233-
} else {
234-
let map = self.get_map(m, false, true);
235+
let has_eval = contains_eval(m, true);
236+
237+
{
238+
let map = self.get_map(m, false, true, has_eval);
235239

236240
m.visit_mut_with(&mut rename_with_config(&map, self.config.clone()));
237241
}
242+
243+
if has_eval {
244+
m.visit_mut_children_with(self);
245+
}
238246
}
239247

240-
fn visit_mut_script(&mut self, s: &mut Script) {
241-
self.preserved = self.renamer.preserved_ids_for_script(s);
242-
self.unresolved = self.get_unresolved(s);
248+
fn visit_mut_script(&mut self, m: &mut Script) {
249+
self.preserved = self.renamer.preserved_ids_for_script(m);
250+
self.unresolved = self.get_unresolved(m);
243251

244-
if contains_eval(s, true) {
245-
s.visit_mut_children_with(self);
246-
} else {
247-
let map = self.get_map(s, false, true);
252+
let has_eval = contains_eval(m, true);
248253

249-
s.visit_mut_with(&mut rename_with_config(&map, self.config.clone()));
254+
{
255+
let map = self.get_map(m, false, true, has_eval);
256+
257+
m.visit_mut_with(&mut rename_with_config(&map, self.config.clone()));
258+
}
259+
260+
if has_eval {
261+
m.visit_mut_children_with(self);
250262
}
251263
}
252264
}

‎crates/swc_ecma_transforms_base/src/resolver/mod.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ pub fn resolver(
151151
config: InnerConfig {
152152
handle_types: typescript,
153153
unresolved_mark,
154+
top_level_mark,
154155
},
155156
})
156157
}
@@ -211,6 +212,7 @@ struct Resolver<'a> {
211212
struct InnerConfig {
212213
handle_types: bool,
213214
unresolved_mark: Mark,
215+
top_level_mark: Mark,
214216
}
215217

216218
impl<'a> Resolver<'a> {
@@ -232,7 +234,11 @@ impl<'a> Resolver<'a> {
232234
F: for<'aa> FnOnce(&mut Resolver<'aa>),
233235
{
234236
let mut child = Resolver {
235-
current: Scope::new(kind, Mark::new(), Some(&self.current)),
237+
current: Scope::new(
238+
kind,
239+
Mark::fresh(self.config.top_level_mark),
240+
Some(&self.current),
241+
),
236242
ident_type: IdentType::Ref,
237243
config: self.config,
238244
in_type: self.in_type,

‎crates/swc_ecma_transforms_base/src/resolver/tests.rs

+4
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ fn test_mark_for() {
6767
InnerConfig {
6868
handle_types: true,
6969
unresolved_mark: Mark::fresh(Mark::root()),
70+
top_level_mark: mark1,
7071
},
7172
);
7273
let mut folder2 = Resolver::new(
7374
Scope::new(ScopeKind::Block, mark2, Some(&folder1.current)),
7475
InnerConfig {
7576
handle_types: true,
7677
unresolved_mark: Mark::fresh(Mark::root()),
78+
top_level_mark: mark2,
7779
},
7880
);
7981
folder2
@@ -86,6 +88,7 @@ fn test_mark_for() {
8688
InnerConfig {
8789
handle_types: true,
8890
unresolved_mark: Mark::fresh(Mark::root()),
91+
top_level_mark: mark3,
8992
},
9093
);
9194
folder3
@@ -99,6 +102,7 @@ fn test_mark_for() {
99102
InnerConfig {
100103
handle_types: true,
101104
unresolved_mark: Mark::fresh(Mark::root()),
105+
top_level_mark: mark4,
102106
},
103107
);
104108
folder4

1 commit comments

Comments
 (1)

github-actions[bot] commented on Jan 16, 2023

@github-actions[bot]

Benchmark

Benchmark suite Current: 82bd5c2 Previous: ff78b8f Ratio
es/full/bugs-1 304824 ns/iter (± 17137) 295111 ns/iter (± 16896) 1.03
es/full/minify/libraries/antd 1671786358 ns/iter (± 26233988) 1680128647 ns/iter (± 23547024) 1.00
es/full/minify/libraries/d3 312132210 ns/iter (± 8921425) 302234398 ns/iter (± 6244631) 1.03
es/full/minify/libraries/echarts 1272514803 ns/iter (± 21304223) 1256390360 ns/iter (± 8714939) 1.01
es/full/minify/libraries/jquery 94704657 ns/iter (± 1700048) 89492168 ns/iter (± 412475) 1.06
es/full/minify/libraries/lodash 111498775 ns/iter (± 2506590) 104962716 ns/iter (± 1213045) 1.06
es/full/minify/libraries/moment 53998514 ns/iter (± 802692) 52532509 ns/iter (± 416623) 1.03
es/full/minify/libraries/react 19878186 ns/iter (± 315304) 18983768 ns/iter (± 111898) 1.05
es/full/minify/libraries/terser 257491066 ns/iter (± 5177381) 245494361 ns/iter (± 1401205) 1.05
es/full/minify/libraries/three 459634666 ns/iter (± 7966117) 437974852 ns/iter (± 3795905) 1.05
es/full/minify/libraries/typescript 3126787064 ns/iter (± 15401985) 3209235567 ns/iter (± 11931984) 0.97
es/full/minify/libraries/victory 730140735 ns/iter (± 14022495) 669307232 ns/iter (± 7648092) 1.09
es/full/minify/libraries/vue 135877541 ns/iter (± 2385199) 129886275 ns/iter (± 854848) 1.05
es/full/codegen/es3 25644 ns/iter (± 63) 26251 ns/iter (± 140) 0.98
es/full/codegen/es5 25683 ns/iter (± 53) 26250 ns/iter (± 39) 0.98
es/full/codegen/es2015 25584 ns/iter (± 35) 26266 ns/iter (± 62) 0.97
es/full/codegen/es2016 25613 ns/iter (± 61) 26210 ns/iter (± 59) 0.98
es/full/codegen/es2017 25632 ns/iter (± 81) 26226 ns/iter (± 80) 0.98
es/full/codegen/es2018 25642 ns/iter (± 72) 26216 ns/iter (± 63) 0.98
es/full/codegen/es2019 25611 ns/iter (± 59) 26194 ns/iter (± 101) 0.98
es/full/codegen/es2020 25629 ns/iter (± 54) 26142 ns/iter (± 121) 0.98
es/full/all/es3 175130473 ns/iter (± 4795528) 169238517 ns/iter (± 3014886) 1.03
es/full/all/es5 166377968 ns/iter (± 6028401) 162000014 ns/iter (± 4491625) 1.03
es/full/all/es2015 128581967 ns/iter (± 2363123) 123066283 ns/iter (± 1280961) 1.04
es/full/all/es2016 128339470 ns/iter (± 1916900) 120950620 ns/iter (± 672051) 1.06
es/full/all/es2017 126152612 ns/iter (± 2027771) 120414797 ns/iter (± 771047) 1.05
es/full/all/es2018 125607788 ns/iter (± 2391921) 119106359 ns/iter (± 733289) 1.05
es/full/all/es2019 122956960 ns/iter (± 2178771) 118196666 ns/iter (± 735222) 1.04
es/full/all/es2020 119438580 ns/iter (± 2816432) 113395914 ns/iter (± 986321) 1.05
es/full/parser 538693 ns/iter (± 7835) 539176 ns/iter (± 8153) 1.00
es/full/base/fixer 21918 ns/iter (± 40) 22065 ns/iter (± 43) 0.99
es/full/base/resolver_and_hygiene 79095 ns/iter (± 82) 79831 ns/iter (± 105) 0.99
serialization of ast node 145 ns/iter (± 1) 145 ns/iter (± 0) 1
serialization of serde 130 ns/iter (± 0) 132 ns/iter (± 0) 0.98
css/minify/libraries/bootstrap 28061860 ns/iter (± 92962) 27755783 ns/iter (± 247454) 1.01
css/visitor/compare/clone 2061658 ns/iter (± 18919) 2091515 ns/iter (± 8170) 0.99
css/visitor/compare/visit_mut_span 2261713 ns/iter (± 8007) 2256780 ns/iter (± 2701) 1.00
css/visitor/compare/visit_mut_span_panic 2324204 ns/iter (± 10996) 2342644 ns/iter (± 5970) 0.99
css/visitor/compare/fold_span 3040731 ns/iter (± 37229) 3085293 ns/iter (± 20814) 0.99
css/visitor/compare/fold_span_panic 3165803 ns/iter (± 12247) 3148981 ns/iter (± 23180) 1.01
css/lexer/bootstrap_5_1_3 5157137 ns/iter (± 1339) 5170005 ns/iter (± 6301) 1.00
css/lexer/foundation_6_7_4 4335943 ns/iter (± 4437) 4348867 ns/iter (± 4109) 1.00
css/lexer/tailwind_3_1_1 826398 ns/iter (± 1849) 827394 ns/iter (± 1769) 1.00
css/parser/bootstrap_5_1_3 21864052 ns/iter (± 127974) 21526990 ns/iter (± 48804) 1.02
css/parser/foundation_6_7_4 17375799 ns/iter (± 89405) 17119472 ns/iter (± 57317) 1.01
css/parser/tailwind_3_1_1 3315858 ns/iter (± 2241) 3304146 ns/iter (± 17404) 1.00
es/codegen/colors 329857 ns/iter (± 184749) 329116 ns/iter (± 184962) 1.00
es/codegen/large 1192363 ns/iter (± 609417) 1214477 ns/iter (± 630704) 0.98
es/codegen/with-parser/colors 48450 ns/iter (± 339) 48576 ns/iter (± 351) 1.00
es/codegen/with-parser/large 536817 ns/iter (± 2353) 532732 ns/iter (± 1881) 1.01
es/minify/libraries/antd 1464234589 ns/iter (± 18554281) 1470006385 ns/iter (± 20867572) 1.00
es/minify/libraries/d3 264890160 ns/iter (± 9372730) 251152729 ns/iter (± 4124471) 1.05
es/minify/libraries/echarts 1115878354 ns/iter (± 25059237) 1072330149 ns/iter (± 10252582) 1.04
es/minify/libraries/jquery 80459958 ns/iter (± 905069) 77055814 ns/iter (± 500506) 1.04
es/minify/libraries/lodash 96930134 ns/iter (± 1638556) 94218308 ns/iter (± 1368156) 1.03
es/minify/libraries/moment 46710259 ns/iter (± 1075542) 45300337 ns/iter (± 181547) 1.03
es/minify/libraries/react 17406616 ns/iter (± 338125) 16768671 ns/iter (± 73296) 1.04
es/minify/libraries/terser 223492251 ns/iter (± 5785699) 211486512 ns/iter (± 4394916) 1.06
es/minify/libraries/three 400731266 ns/iter (± 14599261) 360990279 ns/iter (± 3704829) 1.11
es/minify/libraries/typescript 2688768006 ns/iter (± 25655696) 2828154446 ns/iter (± 43196056) 0.95
es/minify/libraries/victory 604219226 ns/iter (± 22133713) 575960525 ns/iter (± 5207387) 1.05
es/minify/libraries/vue 119481059 ns/iter (± 2123257) 115982961 ns/iter (± 931630) 1.03
es/visitor/compare/clone 2428875 ns/iter (± 13154) 2416421 ns/iter (± 12342) 1.01
es/visitor/compare/visit_mut_span 2816672 ns/iter (± 29592) 2770322 ns/iter (± 3459) 1.02
es/visitor/compare/visit_mut_span_panic 2843806 ns/iter (± 29988) 2823930 ns/iter (± 4717) 1.01
es/visitor/compare/fold_span 3994071 ns/iter (± 24399) 3902664 ns/iter (± 8288) 1.02
es/visitor/compare/fold_span_panic 4089319 ns/iter (± 17965) 4080627 ns/iter (± 6250) 1.00
es/lexer/colors 17173 ns/iter (± 14) 17249 ns/iter (± 12) 1.00
es/lexer/angular 8256626 ns/iter (± 3162) 8249266 ns/iter (± 4460) 1.00
es/lexer/backbone 1078022 ns/iter (± 1357) 1081490 ns/iter (± 597) 1.00
es/lexer/jquery 5959136 ns/iter (± 1872) 5999557 ns/iter (± 5337) 0.99
es/lexer/jquery mobile 9187350 ns/iter (± 3581) 9242252 ns/iter (± 8381) 0.99
es/lexer/mootools 4676690 ns/iter (± 10858) 4693012 ns/iter (± 3456) 1.00
es/lexer/underscore 900132 ns/iter (± 1140) 900267 ns/iter (± 288) 1.00
es/lexer/three 27899578 ns/iter (± 19324) 28025355 ns/iter (± 60345) 1.00
es/lexer/yui 5054381 ns/iter (± 8154) 5052582 ns/iter (± 2455) 1.00
es/parser/colors 30745 ns/iter (± 110) 31799 ns/iter (± 91) 0.97
es/parser/angular 15648782 ns/iter (± 182492) 16251067 ns/iter (± 250593) 0.96
es/parser/backbone 2340780 ns/iter (± 12926) 2348502 ns/iter (± 14921) 1.00
es/parser/jquery 12701909 ns/iter (± 80641) 12645220 ns/iter (± 62060) 1.00
es/parser/jquery mobile 20339852 ns/iter (± 259542) 19942695 ns/iter (± 358419) 1.02
es/parser/mootools 9752872 ns/iter (± 27287) 9637981 ns/iter (± 34155) 1.01
es/parser/underscore 1992775 ns/iter (± 12620) 1992652 ns/iter (± 12316) 1.00
es/parser/three 60513468 ns/iter (± 379017) 58799528 ns/iter (± 604131) 1.03
es/parser/yui 9713487 ns/iter (± 42978) 9784201 ns/iter (± 47292) 0.99
es/preset-env/usage/builtin_type 142798 ns/iter (± 32917) 139189 ns/iter (± 31294) 1.03
es/preset-env/usage/property 21215 ns/iter (± 64) 21368 ns/iter (± 98) 0.99
es/resolver/typescript 111677355 ns/iter (± 2219303) 118681510 ns/iter (± 2197098) 0.94
es/fixer/typescript 85907361 ns/iter (± 500667) 97614557 ns/iter (± 2995652) 0.88
es/hygiene/typescript 182787583 ns/iter (± 1081686) 207777378 ns/iter (± 2737012) 0.88
es/resolver_with_hygiene/typescript 328124543 ns/iter (± 4606613) 350265583 ns/iter (± 2111743) 0.94
es/visitor/base-perf/module_clone 74624 ns/iter (± 2109) 76629 ns/iter (± 1144) 0.97
es/visitor/base-perf/fold_empty 84985 ns/iter (± 1764) 86466 ns/iter (± 1204) 0.98
es/visitor/base-perf/fold_noop_impl_all 85285 ns/iter (± 1604) 86221 ns/iter (± 886) 0.99
es/visitor/base-perf/fold_noop_impl_vec 85525 ns/iter (± 1362) 86589 ns/iter (± 852) 0.99
es/visitor/base-perf/boxing_boxed_clone 56 ns/iter (± 0) 56 ns/iter (± 0) 1
es/visitor/base-perf/boxing_unboxed_clone 59 ns/iter (± 0) 59 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 105 ns/iter (± 0) 106 ns/iter (± 0) 0.99
es/visitor/base-perf/boxing_unboxed 103 ns/iter (± 0) 105 ns/iter (± 0) 0.98
es/visitor/base-perf/visit_contains_this 3566 ns/iter (± 101) 3627 ns/iter (± 52) 0.98
es/base/parallel/resolver/typescript 5733069217 ns/iter (± 434599667) 5826706968 ns/iter (± 543462552) 0.98
es/base/parallel/hygiene/typescript 2116272039 ns/iter (± 30967896) 2374325660 ns/iter (± 16966357) 0.89
misc/visitors/time-complexity/time 5 92 ns/iter (± 0) 108 ns/iter (± 0) 0.85
misc/visitors/time-complexity/time 10 312 ns/iter (± 0) 359 ns/iter (± 1) 0.87
misc/visitors/time-complexity/time 15 600 ns/iter (± 1) 685 ns/iter (± 4) 0.88
misc/visitors/time-complexity/time 20 1122 ns/iter (± 3) 1272 ns/iter (± 1) 0.88
misc/visitors/time-complexity/time 40 5912 ns/iter (± 32) 6791 ns/iter (± 44) 0.87
misc/visitors/time-complexity/time 60 15339 ns/iter (± 46) 17386 ns/iter (± 153) 0.88
es/full-target/es2016 187538 ns/iter (± 571) 190507 ns/iter (± 943) 0.98
es/full-target/es2017 182177 ns/iter (± 521) 184608 ns/iter (± 672) 0.99
es/full-target/es2018 172020 ns/iter (± 642) 173205 ns/iter (± 441) 0.99
es2020_nullish_coalescing 66907 ns/iter (± 7795) 67558 ns/iter (± 145) 0.99
es2020_optional_chaining 95423 ns/iter (± 3108) 96391 ns/iter (± 176) 0.99
es2022_class_properties 94013 ns/iter (± 247) 94516 ns/iter (± 238) 0.99
es2018_object_rest_spread 71179 ns/iter (± 194) 72137 ns/iter (± 123) 0.99
es2019_optional_catch_binding 61449 ns/iter (± 123) 61497 ns/iter (± 136) 1.00
es2017_async_to_generator 61777 ns/iter (± 56) 62602 ns/iter (± 114) 0.99
es2016_exponentiation 64994 ns/iter (± 131) 66323 ns/iter (± 116) 0.98
es2015_arrow 70216 ns/iter (± 181) 70735 ns/iter (± 205) 0.99
es2015_block_scoped_fn 66119 ns/iter (± 193) 67285 ns/iter (± 145) 0.98
es2015_block_scoping 157365 ns/iter (± 10118) 147762 ns/iter (± 9764) 1.06
es2015_classes 116481 ns/iter (± 455) 117734 ns/iter (± 454) 0.99
es2015_computed_props 61434 ns/iter (± 117) 61699 ns/iter (± 93) 1.00
es2015_destructuring 117028 ns/iter (± 188) 115578 ns/iter (± 294) 1.01
es2015_duplicate_keys 64138 ns/iter (± 61) 64235 ns/iter (± 61) 1.00
es2015_parameters 79370 ns/iter (± 149) 80282 ns/iter (± 135) 0.99
es2015_fn_name 66465 ns/iter (± 596) 67180 ns/iter (± 422) 0.99
es2015_for_of 64440 ns/iter (± 92) 65142 ns/iter (± 152) 0.99
es2015_instanceof 63191 ns/iter (± 121) 63576 ns/iter (± 103) 0.99
es2015_shorthand_property 61195 ns/iter (± 87) 61904 ns/iter (± 95) 0.99
es2015_spread 61167 ns/iter (± 158) 61642 ns/iter (± 156) 0.99
es2015_sticky_regex 62452 ns/iter (± 176) 62776 ns/iter (± 127) 0.99
es2015_typeof_symbol 62561 ns/iter (± 112) 62811 ns/iter (± 75) 1.00
es/transform/baseline/base 52031 ns/iter (± 111) 52305 ns/iter (± 87) 0.99
es/transform/baseline/common_reserved_word 62813 ns/iter (± 127) 63289 ns/iter (± 85) 0.99
es/transform/baseline/common_typescript 146508 ns/iter (± 3204) 144872 ns/iter (± 4008) 1.01
es/target/es3 169449 ns/iter (± 874) 171351 ns/iter (± 329) 0.99
es/target/es2015 631565 ns/iter (± 989) 630840 ns/iter (± 1829) 1.00
es/target/es2016 65251 ns/iter (± 167) 66393 ns/iter (± 151) 0.98
es/target/es2017 61709 ns/iter (± 104) 62650 ns/iter (± 105) 0.98
es/target/es2018 81299 ns/iter (± 199) 82335 ns/iter (± 153) 0.99
es/target/es2020 132893 ns/iter (± 212) 133808 ns/iter (± 395) 0.99
babelify-only 675692 ns/iter (± 426) 673462 ns/iter (± 1316) 1.00
parse_and_babelify_angular 42585612 ns/iter (± 1647328) 43337279 ns/iter (± 980284) 0.98
parse_and_babelify_backbone 5517295 ns/iter (± 27594) 5443213 ns/iter (± 44492) 1.01
parse_and_babelify_jquery 32169067 ns/iter (± 336812) 33062274 ns/iter (± 471763) 0.97
parse_and_babelify_jquery_mobile 55116087 ns/iter (± 535615) 55811781 ns/iter (± 903865) 0.99
parse_and_babelify_mootools 33334192 ns/iter (± 211117) 33466255 ns/iter (± 226806) 1.00
parse_and_babelify_underscore 4399509 ns/iter (± 20425) 4344022 ns/iter (± 10431) 1.01
parse_and_babelify_yui 32294726 ns/iter (± 465338) 32966957 ns/iter (± 310363) 0.98
html/minify/document/css_spec 42995682 ns/iter (± 221551) 41797085 ns/iter (± 258628) 1.03
html/minify/document/github 17695641 ns/iter (± 49718) 17423284 ns/iter (± 14593) 1.02
html/minify/document/stackoverflow 15917577 ns/iter (± 90756) 15673424 ns/iter (± 18131) 1.02
html/minify/document_fragment/css_spec 40893666 ns/iter (± 238122) 39758882 ns/iter (± 285499) 1.03
html/minify/document_fragment/github 16832225 ns/iter (± 69165) 16853455 ns/iter (± 14923) 1.00
html/minify/document_fragment/stackoverflow 15221975 ns/iter (± 39813) 15255934 ns/iter (± 11813) 1.00
html/document/visitor/compare/clone 341915 ns/iter (± 2436) 339471 ns/iter (± 2121) 1.01
html/document/visitor/compare/visit_mut_span 366765 ns/iter (± 2454) 365420 ns/iter (± 1559) 1.00
html/document/visitor/compare/visit_mut_span_panic 375650 ns/iter (± 2040) 376643 ns/iter (± 2201) 1.00
html/document/visitor/compare/fold_span 404954 ns/iter (± 2022) 405990 ns/iter (± 2025) 1.00
html/document/visitor/compare/fold_span_panic 461218 ns/iter (± 1079) 464573 ns/iter (± 3050) 0.99
html/document_fragment/visitor/compare/clone 337601 ns/iter (± 1957) 339023 ns/iter (± 1787) 1.00
html/document_fragment/visitor/compare/visit_mut_span 363817 ns/iter (± 1581) 366342 ns/iter (± 1939) 0.99
html/document_fragment/visitor/compare/visit_mut_span_panic 377297 ns/iter (± 1922) 373829 ns/iter (± 2301) 1.01
html/document_fragment/visitor/compare/fold_span 407084 ns/iter (± 1627) 408121 ns/iter (± 2790) 1.00
html/document_fragment/visitor/compare/fold_span_panic 460705 ns/iter (± 1768) 458326 ns/iter (± 1578) 1.01
html/lexer/css_2021_spec 15632490 ns/iter (± 13745) 15587407 ns/iter (± 21710) 1.00
html/lexer/github_com_17_05_2022 6037066 ns/iter (± 1834) 6018909 ns/iter (± 4789) 1.00
html/lexer/stackoverflow_com_17_05_2022 5652062 ns/iter (± 7136) 5616949 ns/iter (± 3505) 1.01
html/parser/parser_document/css_2021_spec 25321289 ns/iter (± 74872) 25773651 ns/iter (± 234002) 0.98
html/parser/parser_document/github_com_17_05_2022 8730962 ns/iter (± 14612) 8745539 ns/iter (± 5867) 1.00
html/parser/parser_document/stackoverflow_com_17_05_2022 7697658 ns/iter (± 23054) 7707589 ns/iter (± 9178) 1.00
html/parser/parser_document_fragment/css_2021_spec 25584372 ns/iter (± 127952) 25829663 ns/iter (± 134795) 0.99
html/parser/parser_document_fragment/github_com_17_05_2022 8764979 ns/iter (± 22436) 8731558 ns/iter (± 9175) 1.00
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022 7762678 ns/iter (± 13508) 7731663 ns/iter (± 6278) 1.00

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

Please sign in to comment.