Skip to content

Commit cc4146c

Browse files
authoredJun 8, 2023
fix(es/compat): Make stage 3 decorator pass use correct state for inner classes (#7508)
**Related issue:** - Closes #7499.
1 parent 37634a7 commit cc4146c

File tree

6 files changed

+226
-135
lines changed

6 files changed

+226
-135
lines changed
 

‎crates/swc_ecma_transforms_proposal/src/decorator_2022_03.rs

+122-85
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
use std::{iter::once, mem::transmute};
1+
use std::{
2+
iter::once,
3+
mem::{take, transmute},
4+
};
25

36
use rustc_hash::FxHashMap;
47
use swc_atoms::JsWord;
@@ -15,10 +18,25 @@ pub fn decorator_2022_03() -> impl VisitMut + Fold {
1518
as_folder(Decorator202203::default())
1619
}
1720

18-
#[derive(Debug, Default)]
21+
#[derive(Default)]
1922
struct Decorator202203 {
2023
/// Variables without initializer.
2124
extra_vars: Vec<VarDeclarator>,
25+
26+
extra_lets: Vec<VarDeclarator>,
27+
28+
state: ClassState,
29+
30+
/// Prepended before the class
31+
pre_class_inits: Vec<Box<Expr>>,
32+
33+
rename_map: FxHashMap<Id, Id>,
34+
35+
extra_exports: Vec<ExportSpecifier>,
36+
}
37+
38+
#[derive(Default)]
39+
struct ClassState {
2240
static_lhs: Vec<Ident>,
2341
proto_lhs: Vec<Ident>,
2442

@@ -33,17 +51,8 @@ struct Decorator202203 {
3351
/// Injected into static blocks.
3452
extra_stmts: Vec<Stmt>,
3553

36-
/// Prepended before the class
37-
pre_class_inits: Vec<Box<Expr>>,
38-
3954
class_lhs: Vec<Option<Pat>>,
4055
class_decorators: Vec<Option<ExprOrSpread>>,
41-
42-
extra_lets: Vec<VarDeclarator>,
43-
44-
extra_exports: Vec<ExportSpecifier>,
45-
46-
rename_map: FxHashMap<Id, Id>,
4756
}
4857

4958
impl Decorator202203 {
@@ -81,23 +90,28 @@ impl Decorator202203 {
8190

8291
/// Moves `cur_inits` to `extra_stmts`.
8392
fn consume_inits(&mut self) {
84-
if self.init_proto_args.is_empty()
85-
&& self.init_static_args.is_empty()
86-
&& self.init_proto.is_none()
87-
&& self.init_static.is_none()
88-
&& self.class_decorators.is_empty()
93+
if self.state.init_proto_args.is_empty()
94+
&& self.state.init_static_args.is_empty()
95+
&& self.state.init_proto.is_none()
96+
&& self.state.init_static.is_none()
97+
&& self.state.class_decorators.is_empty()
8998
{
9099
return;
91100
}
92101

93102
let mut e_lhs = vec![];
94103
let mut combined_args = vec![ThisExpr { span: DUMMY_SP }.as_arg()];
95104

96-
for id in self.static_lhs.drain(..).chain(self.proto_lhs.drain(..)) {
105+
for id in self
106+
.state
107+
.static_lhs
108+
.drain(..)
109+
.chain(self.state.proto_lhs.drain(..))
110+
{
97111
e_lhs.push(Some(id.into()));
98112
}
99113

100-
if let Some(init) = self.init_proto.clone() {
114+
if let Some(init) = self.state.init_proto.clone() {
101115
self.extra_vars.push(VarDeclarator {
102116
span: DUMMY_SP,
103117
name: Pat::Ident(init.clone().into()),
@@ -108,7 +122,7 @@ impl Decorator202203 {
108122
e_lhs.push(Some(init.into()));
109123
}
110124

111-
if let Some(init) = self.init_static.clone() {
125+
if let Some(init) = self.state.init_static.clone() {
112126
self.extra_vars.push(VarDeclarator {
113127
span: DUMMY_SP,
114128
name: Pat::Ident(init.clone().into()),
@@ -123,9 +137,10 @@ impl Decorator202203 {
123137
ArrayLit {
124138
span: DUMMY_SP,
125139
elems: self
140+
.state
126141
.init_static_args
127142
.drain(..)
128-
.chain(self.init_proto_args.drain(..))
143+
.chain(self.state.init_proto_args.drain(..))
129144
.collect(),
130145
}
131146
.as_arg(),
@@ -134,7 +149,7 @@ impl Decorator202203 {
134149
combined_args.push(
135150
ArrayLit {
136151
span: DUMMY_SP,
137-
elems: self.class_decorators.take(),
152+
elems: self.state.class_decorators.take(),
138153
}
139154
.as_arg(),
140155
);
@@ -153,14 +168,14 @@ impl Decorator202203 {
153168
}))
154169
};
155170

156-
let c_pat = if self.class_lhs.is_empty() {
171+
let c_pat = if self.state.class_lhs.is_empty() {
157172
None
158173
} else {
159174
Some(ObjectPatProp::KeyValue(KeyValuePatProp {
160175
key: PropName::Ident(quote_ident!("c")),
161176
value: Box::new(Pat::Array(ArrayPat {
162177
span: DUMMY_SP,
163-
elems: self.class_lhs.take(),
178+
elems: self.state.class_lhs.take(),
164179
type_ann: Default::default(),
165180
optional: false,
166181
})),
@@ -184,13 +199,13 @@ impl Decorator202203 {
184199
})),
185200
}));
186201

187-
self.extra_stmts.push(Stmt::Expr(ExprStmt {
202+
self.state.extra_stmts.push(Stmt::Expr(ExprStmt {
188203
span: DUMMY_SP,
189204
expr,
190205
}));
191206

192-
if let Some(init) = self.init_static.take() {
193-
self.extra_stmts.push(Stmt::Expr(ExprStmt {
207+
if let Some(init) = self.state.init_static.take() {
208+
self.state.extra_stmts.push(Stmt::Expr(ExprStmt {
194209
span: DUMMY_SP,
195210
expr: Box::new(Expr::Call(CallExpr {
196211
span: DUMMY_SP,
@@ -332,8 +347,10 @@ impl Decorator202203 {
332347
replace_ident(&mut class.body, ident.to_id(), &new_class_name);
333348
}
334349

335-
self.class_lhs.push(Some(new_class_name.clone().into()));
336-
self.class_lhs.push(Some(init_class.clone().into()));
350+
self.state
351+
.class_lhs
352+
.push(Some(new_class_name.clone().into()));
353+
self.state.class_lhs.push(Some(init_class.clone().into()));
337354

338355
self.extra_vars.push(VarDeclarator {
339356
span: DUMMY_SP,
@@ -343,7 +360,7 @@ impl Decorator202203 {
343360
});
344361

345362
let decorators = self.preserve_side_effect_of_decorators(class.decorators.take());
346-
self.class_decorators.extend(decorators);
363+
self.state.class_decorators.extend(decorators);
347364

348365
{
349366
let call_stmt = CallExpr {
@@ -367,6 +384,8 @@ impl Decorator202203 {
367384
}
368385

369386
fn handle_class_decl(&mut self, c: &mut ClassDecl) -> Option<Stmt> {
387+
let old_state = take(&mut self.state);
388+
370389
if !c.class.decorators.is_empty() {
371390
let decorators = self.preserve_side_effect_of_decorators(c.class.decorators.take());
372391

@@ -392,10 +411,12 @@ impl Decorator202203 {
392411
self.rename_map
393412
.insert(c.ident.to_id(), new_class_name.to_id());
394413

395-
self.class_lhs.push(Some(new_class_name.clone().into()));
396-
self.class_lhs.push(Some(init_class.clone().into()));
414+
self.state
415+
.class_lhs
416+
.push(Some(new_class_name.clone().into()));
417+
self.state.class_lhs.push(Some(init_class.clone().into()));
397418

398-
self.class_decorators.extend(decorators);
419+
self.state.class_decorators.extend(decorators);
399420

400421
let mut body = c.class.body.take();
401422

@@ -594,6 +615,8 @@ impl Decorator202203 {
594615
implements: Default::default(),
595616
});
596617

618+
self.state = old_state;
619+
597620
return Some(
598621
NewExpr {
599622
span: DUMMY_SP,
@@ -633,10 +656,14 @@ impl Decorator202203 {
633656
},
634657
}));
635658

659+
self.state = old_state;
660+
636661
return Some(Stmt::Decl(Decl::Class(c.take())));
637662
}
638663
}
639664

665+
self.state = old_state;
666+
640667
None
641668
}
642669

@@ -706,12 +733,12 @@ impl VisitMut for Decorator202203 {
706733
noop_visit_mut_type!();
707734

708735
fn visit_mut_class(&mut self, n: &mut Class) {
709-
let old_stmts = self.extra_stmts.take();
736+
let old_stmts = self.state.extra_stmts.take();
710737

711738
n.visit_mut_children_with(self);
712739

713-
if !self.is_init_proto_called {
714-
if let Some(init_proto) = self.init_proto.clone() {
740+
if !self.state.is_init_proto_called {
741+
if let Some(init_proto) = self.state.init_proto.clone() {
715742
let c = self.ensure_constructor(n);
716743

717744
inject_after_super(
@@ -728,23 +755,23 @@ impl VisitMut for Decorator202203 {
728755

729756
self.consume_inits();
730757

731-
if !self.extra_stmts.is_empty() {
758+
if !self.state.extra_stmts.is_empty() {
732759
n.body.insert(
733760
0,
734761
ClassMember::StaticBlock(StaticBlock {
735762
span: DUMMY_SP,
736763
body: BlockStmt {
737764
span: DUMMY_SP,
738-
stmts: self.extra_stmts.take(),
765+
stmts: self.state.extra_stmts.take(),
739766
},
740767
}),
741768
);
742769
}
743770

744-
self.init_proto = None;
745-
self.is_init_proto_called = false;
771+
self.state.init_proto = None;
772+
self.state.is_init_proto_called = false;
746773

747-
self.extra_stmts = old_stmts;
774+
self.state.extra_stmts = old_stmts;
748775
}
749776

750777
fn visit_mut_class_member(&mut self, n: &mut ClassMember) {
@@ -768,10 +795,12 @@ impl VisitMut for Decorator202203 {
768795
});
769796

770797
if p.is_static {
771-
self.init_static
798+
self.state
799+
.init_static
772800
.get_or_insert_with(|| private_ident!("_initStatic"));
773801
} else {
774-
self.init_proto
802+
self.state
803+
.init_proto
775804
.get_or_insert_with(|| private_ident!("_initProto"));
776805
}
777806

@@ -808,15 +837,15 @@ impl VisitMut for Decorator202203 {
808837
.as_arg(),
809838
);
810839
if p.is_static {
811-
self.init_static_args.push(arg);
840+
self.state.init_static_args.push(arg);
812841
} else {
813-
self.init_proto_args.push(arg);
842+
self.state.init_proto_args.push(arg);
814843
}
815844

816845
if p.is_static {
817-
self.static_lhs.push(init.clone());
846+
self.state.static_lhs.push(init.clone());
818847
} else {
819-
self.proto_lhs.push(init.clone());
848+
self.state.proto_lhs.push(init.clone());
820849
}
821850

822851
match p.kind {
@@ -920,23 +949,25 @@ impl VisitMut for Decorator202203 {
920949
value: if accessor.decorators.is_empty() {
921950
accessor.value
922951
} else {
923-
let init_proto = if self.is_init_proto_called || accessor.is_static {
924-
None
925-
} else {
926-
self.is_init_proto_called = true;
927-
928-
let init_proto = self
929-
.init_proto
930-
.get_or_insert_with(|| private_ident!("_initProto"))
931-
.clone();
932-
933-
Some(Box::new(Expr::Call(CallExpr {
934-
span: DUMMY_SP,
935-
callee: init_proto.clone().as_callee(),
936-
args: vec![ThisExpr { span: DUMMY_SP }.as_arg()],
937-
type_args: Default::default(),
938-
})))
939-
};
952+
let init_proto =
953+
if self.state.is_init_proto_called || accessor.is_static {
954+
None
955+
} else {
956+
self.state.is_init_proto_called = true;
957+
958+
let init_proto = self
959+
.state
960+
.init_proto
961+
.get_or_insert_with(|| private_ident!("_initProto"))
962+
.clone();
963+
964+
Some(Box::new(Expr::Call(CallExpr {
965+
span: DUMMY_SP,
966+
callee: init_proto.clone().as_callee(),
967+
args: vec![ThisExpr { span: DUMMY_SP }.as_arg()],
968+
type_args: Default::default(),
969+
})))
970+
};
940971

941972
let init_call = Box::new(Expr::Call(CallExpr {
942973
span: DUMMY_SP,
@@ -1161,22 +1192,26 @@ impl VisitMut for Decorator202203 {
11611192
};
11621193

11631194
if accessor.is_static {
1164-
self.static_lhs.push(init);
1165-
self.init_static_args.push(Some(initialize_init));
1166-
self.static_lhs
1195+
self.state.static_lhs.push(init);
1196+
self.state.init_static_args.push(Some(initialize_init));
1197+
self.state
1198+
.static_lhs
11671199
.extend(getter_var.into_iter().chain(setter_var));
11681200
} else {
1169-
self.proto_lhs.push(init);
1170-
self.init_proto_args.push(Some(initialize_init));
1171-
self.proto_lhs
1201+
self.state.proto_lhs.push(init);
1202+
self.state.init_proto_args.push(Some(initialize_init));
1203+
self.state
1204+
.proto_lhs
11721205
.extend(getter_var.into_iter().chain(setter_var));
11731206
}
11741207

11751208
if accessor.is_static {
1176-
self.init_static
1209+
self.state
1210+
.init_static
11771211
.get_or_insert_with(|| private_ident!("_initStatic"));
11781212
} else {
1179-
self.init_proto
1213+
self.state
1214+
.init_proto
11801215
.get_or_insert_with(|| private_ident!("_initProto"));
11811216
}
11821217
}
@@ -1283,10 +1318,12 @@ impl VisitMut for Decorator202203 {
12831318
let (name, _init) = self.initializer_name(&mut n.key, "call");
12841319

12851320
if n.is_static {
1286-
self.init_static
1321+
self.state
1322+
.init_static
12871323
.get_or_insert_with(|| private_ident!("_initStatic"));
12881324
} else {
1289-
self.init_proto
1325+
self.state
1326+
.init_proto
12901327
.get_or_insert_with(|| private_ident!("_initProto"));
12911328
}
12921329

@@ -1312,9 +1349,9 @@ impl VisitMut for Decorator202203 {
13121349
.as_arg(),
13131350
);
13141351
if n.is_static {
1315-
self.init_static_args.push(arg);
1352+
self.state.init_static_args.push(arg);
13161353
} else {
1317-
self.init_proto_args.push(arg);
1354+
self.state.init_proto_args.push(arg);
13181355
}
13191356
}
13201357

@@ -1361,11 +1398,11 @@ impl VisitMut for Decorator202203 {
13611398
};
13621399

13631400
if p.is_static {
1364-
self.static_lhs.push(init);
1365-
self.init_static_args.push(initialize_init);
1401+
self.state.static_lhs.push(init);
1402+
self.state.init_static_args.push(initialize_init);
13661403
} else {
1367-
self.proto_lhs.push(init);
1368-
self.init_proto_args.push(initialize_init);
1404+
self.state.proto_lhs.push(init);
1405+
self.state.init_proto_args.push(initialize_init);
13691406
}
13701407
}
13711408

@@ -1586,11 +1623,11 @@ impl VisitMut for Decorator202203 {
15861623
};
15871624

15881625
if p.is_static {
1589-
self.static_lhs.push(init);
1590-
self.init_static_args.push(Some(initialize_init));
1626+
self.state.static_lhs.push(init);
1627+
self.state.init_static_args.push(Some(initialize_init));
15911628
} else {
1592-
self.proto_lhs.push(init);
1593-
self.init_proto_args.push(Some(initialize_init));
1629+
self.state.proto_lhs.push(init);
1630+
self.state.init_proto_args.push(Some(initialize_init));
15941631
}
15951632
}
15961633

@@ -1608,9 +1645,9 @@ impl VisitMut for Decorator202203 {
16081645
}
16091646

16101647
fn visit_mut_stmts(&mut self, n: &mut Vec<Stmt>) {
1648+
let old_state = take(&mut self.state);
16111649
let old_pre_class_inits = self.pre_class_inits.take();
16121650
let old_extra_lets = self.extra_lets.take();
1613-
let old_extra_stmts = self.extra_stmts.take();
16141651
let old_extra_vars = self.extra_vars.take();
16151652

16161653
let mut new = Vec::with_capacity(n.len());
@@ -1650,9 +1687,9 @@ impl VisitMut for Decorator202203 {
16501687
*n = new;
16511688

16521689
self.extra_vars = old_extra_vars;
1653-
self.extra_stmts = old_extra_stmts;
16541690
self.extra_lets = old_extra_lets;
16551691
self.pre_class_inits = old_pre_class_inits;
1692+
self.state = old_state;
16561693
}
16571694
}
16581695

‎crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc--to-es2015/valid-expression-formats/output.js

+31-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var _dec, _dec1, _dec2, _dec3, _initClass, _dec4, _dec5, _dec6, _dec7;
1+
var _dec, _dec1, _dec2, _dec3, _initClass, _dec4, _dec5, _dec6, _dec7, _initProto;
22
const dec = ()=>{};
33
let _Foo;
44
_dec = call(), _dec1 = chain.expr(), _dec2 = arbitrary + expr, _dec3 = array[expr], _dec4 = call(), _dec5 = chain.expr(), _dec6 = arbitrary + expr, _dec7 = array[expr];
@@ -7,40 +7,22 @@ class Foo {
77
method() {}
88
makeClass() {
99
var _Nested, __;
10-
var _dec8, _init_bar, _initProto;
11-
_dec8 = _class_private_field_get(this, _a);
10+
var _dec, _init_bar;
11+
_dec = _class_private_field_get(this, _a);
1212
return _Nested = class Nested {
1313
constructor(){
1414
_define_property(this, "bar", _init_bar(this));
15-
_initProto(this);
1615
}
1716
}, __ = {
1817
writable: true,
1918
value: (()=>{
20-
({ e: [_init_bar, _initProto] , c: [_Foo, _initClass] } = _apply_decs_2203_r(_Nested, [
19+
({ e: [_init_bar] } = _apply_decs_2203_r(_Nested, [
2120
[
22-
[
23-
dec,
24-
_dec4,
25-
_dec5,
26-
_dec6,
27-
_dec7
28-
],
29-
2,
30-
"method"
31-
],
32-
[
33-
_dec8,
21+
_dec,
3422
0,
3523
"bar"
3624
]
37-
], [
38-
dec,
39-
_dec,
40-
_dec1,
41-
_dec2,
42-
_dec3
43-
]));
25+
], []));
4426
})()
4527
}, _Nested;
4628
}
@@ -49,9 +31,34 @@ class Foo {
4931
writable: true,
5032
value: void 0
5133
});
34+
_initProto(this);
5235
}
5336
}
5437
var __ = {
38+
writable: true,
39+
value: (()=>{
40+
({ e: [_initProto], c: [_Foo, _initClass] } = _apply_decs_2203_r(Foo, [
41+
[
42+
[
43+
dec,
44+
_dec4,
45+
_dec5,
46+
_dec6,
47+
_dec7
48+
],
49+
2,
50+
"method"
51+
]
52+
], [
53+
dec,
54+
_dec,
55+
_dec1,
56+
_dec2,
57+
_dec3
58+
]));
59+
})()
60+
};
61+
var __1 = {
5562
writable: true,
5663
value: (()=>{
5764
_initClass();

‎crates/swc_ecma_transforms_proposal/tests/decorators/2022-03-misc/valid-expression-formats/output.js

+30-26
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,46 @@
1-
var _dec, _dec1, _dec2, _dec3, _initClass, _dec4, _dec5, _dec6, _dec7;
1+
var _dec, _dec1, _dec2, _dec3, _initClass, _dec4, _dec5, _dec6, _dec7, _initProto;
22
const dec = ()=>{};
33
let _Foo;
44
_dec = call(), _dec1 = chain.expr(), _dec2 = arbitrary + expr, _dec3 = array[expr], _dec4 = call(), _dec5 = chain.expr(), _dec6 = arbitrary + expr, _dec7 = array[expr];
55
class Foo {
6+
static{
7+
({ e: [_initProto], c: [_Foo, _initClass] } = _apply_decs_2203_r(this, [
8+
[
9+
[
10+
dec,
11+
_dec4,
12+
_dec5,
13+
_dec6,
14+
_dec7
15+
],
16+
2,
17+
"method"
18+
]
19+
], [
20+
dec,
21+
_dec,
22+
_dec1,
23+
_dec2,
24+
_dec3
25+
]));
26+
}
27+
constructor(){
28+
_initProto(this);
29+
}
630
#a;
731
method() {}
832
makeClass() {
9-
var _dec8, _init_bar, _initProto;
10-
_dec8 = this.#a;
33+
var _dec, _init_bar;
34+
_dec = this.#a;
1135
return class Nested {
1236
static{
13-
({ e: [_init_bar, _initProto] , c: [_Foo, _initClass] } = _apply_decs_2203_r(this, [
37+
({ e: [_init_bar] } = _apply_decs_2203_r(this, [
1438
[
15-
[
16-
dec,
17-
_dec4,
18-
_dec5,
19-
_dec6,
20-
_dec7
21-
],
22-
2,
23-
"method"
24-
],
25-
[
26-
_dec8,
39+
_dec,
2740
0,
2841
"bar"
2942
]
30-
], [
31-
dec,
32-
_dec,
33-
_dec1,
34-
_dec2,
35-
_dec3
36-
]));
37-
}
38-
constructor(){
39-
_initProto(this);
43+
], []));
4044
}
4145
bar = _init_bar(this);
4246
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Tests {
2+
@test
3+
'computed'() { }
4+
5+
id() { class Bar { } }
6+
}
7+
8+
function test(fn) {
9+
return fn;
10+
}
11+
12+
13+
let t = new Tests();
14+
t.id()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
var _computedKey, _initProto;
2+
_computedKey = 'computed';
3+
class Tests {
4+
static{
5+
({ e: [_initProto] } = _apply_decs_2203_r(this, [
6+
[
7+
test,
8+
2,
9+
_computedKey
10+
]
11+
], []));
12+
}
13+
constructor(){
14+
_initProto(this);
15+
}
16+
[_computedKey]() {}
17+
id() {
18+
class Bar {
19+
}
20+
}
21+
}
22+
function test(fn) {
23+
return fn;
24+
}
25+
let t = new Tests();
26+
t.id();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": [["proposal-decorators", { "version": "2022-03" }]]
3+
}

1 commit comments

Comments
 (1)

github-actions[bot] commented on Jun 8, 2023

@github-actions[bot]

Benchmark

Benchmark suite Current: cc4146c Previous: 7f9f0b8 Ratio
es/full/bugs-1 303955 ns/iter (± 2324) 307783 ns/iter (± 7577) 0.99
es/full/minify/libraries/antd 1467484525 ns/iter (± 12067225) 1490980646 ns/iter (± 17109322) 0.98
es/full/minify/libraries/d3 311934217 ns/iter (± 2279178) 315376713 ns/iter (± 5958092) 0.99
es/full/minify/libraries/echarts 1201620404 ns/iter (± 14714019) 1206994815 ns/iter (± 5037923) 1.00
es/full/minify/libraries/jquery 95044278 ns/iter (± 445442) 95047604 ns/iter (± 239309) 1.00
es/full/minify/libraries/lodash 112583075 ns/iter (± 282096) 113142735 ns/iter (± 1357721) 1.00
es/full/minify/libraries/moment 55796479 ns/iter (± 184538) 55839073 ns/iter (± 170007) 1.00
es/full/minify/libraries/react 19913663 ns/iter (± 186646) 19999043 ns/iter (± 37357) 1.00
es/full/minify/libraries/terser 250205455 ns/iter (± 2198087) 246446972 ns/iter (± 710794) 1.02
es/full/minify/libraries/three 452430818 ns/iter (± 3223615) 435833072 ns/iter (± 2456695) 1.04
es/full/minify/libraries/typescript 3009212200 ns/iter (± 35810181) 3003623373 ns/iter (± 9652755) 1.00
es/full/minify/libraries/victory 643910043 ns/iter (± 6962487) 647142461 ns/iter (± 5333664) 1.00
es/full/minify/libraries/vue 135634063 ns/iter (± 332995) 138230877 ns/iter (± 644517) 0.98
es/full/codegen/es3 35988 ns/iter (± 246) 36321 ns/iter (± 120) 0.99
es/full/codegen/es5 36126 ns/iter (± 133) 36282 ns/iter (± 36) 1.00
es/full/codegen/es2015 36088 ns/iter (± 81) 36283 ns/iter (± 65) 0.99
es/full/codegen/es2016 35999 ns/iter (± 74) 36245 ns/iter (± 64) 0.99
es/full/codegen/es2017 36109 ns/iter (± 52) 36309 ns/iter (± 43) 0.99
es/full/codegen/es2018 35933 ns/iter (± 152) 36232 ns/iter (± 84) 0.99
es/full/codegen/es2019 36182 ns/iter (± 113) 36323 ns/iter (± 85) 1.00
es/full/codegen/es2020 36112 ns/iter (± 81) 36286 ns/iter (± 53) 1.00
es/full/all/es3 180025541 ns/iter (± 926230) 179791533 ns/iter (± 719633) 1.00
es/full/all/es5 169749805 ns/iter (± 594731) 171539536 ns/iter (± 886500) 0.99
es/full/all/es2015 126510925 ns/iter (± 586634) 127066027 ns/iter (± 498451) 1.00
es/full/all/es2016 125599591 ns/iter (± 462772) 126586740 ns/iter (± 521394) 0.99
es/full/all/es2017 124701997 ns/iter (± 873902) 125489097 ns/iter (± 708529) 0.99
es/full/all/es2018 122601797 ns/iter (± 454033) 123958117 ns/iter (± 501698) 0.99
es/full/all/es2019 122285845 ns/iter (± 618755) 123461546 ns/iter (± 574127) 0.99
es/full/all/es2020 116097408 ns/iter (± 635344) 118184621 ns/iter (± 317167) 0.98
es/full/parser 514292 ns/iter (± 7108) 517191 ns/iter (± 3961) 0.99
es/full/base/fixer 19248 ns/iter (± 84) 18236 ns/iter (± 128) 1.06
es/full/base/resolver_and_hygiene 95327 ns/iter (± 193) 90877 ns/iter (± 276) 1.05
serialization of serde 313 ns/iter (± 2) 316 ns/iter (± 0) 0.99
css/minify/libraries/bootstrap 30858437 ns/iter (± 121565) 30915808 ns/iter (± 144697) 1.00
css/visitor/compare/clone 2149619 ns/iter (± 10468) 1906383 ns/iter (± 12333) 1.13
css/visitor/compare/visit_mut_span 2276221 ns/iter (± 16431) 2050453 ns/iter (± 6002) 1.11
css/visitor/compare/visit_mut_span_panic 2350754 ns/iter (± 24420) 2128272 ns/iter (± 7926) 1.10
css/visitor/compare/fold_span 2997188 ns/iter (± 18103) 2807297 ns/iter (± 12453) 1.07
css/visitor/compare/fold_span_panic 3181430 ns/iter (± 37217) 3016782 ns/iter (± 11302) 1.05
css/lexer/bootstrap_5_1_3 4808768 ns/iter (± 11285) 4814585 ns/iter (± 2310) 1.00
css/lexer/foundation_6_7_4 4042674 ns/iter (± 4628) 4051902 ns/iter (± 1979) 1.00
css/lexer/tailwind_3_1_1 765232 ns/iter (± 793) 764265 ns/iter (± 278) 1.00
css/parser/bootstrap_5_1_3 20577245 ns/iter (± 84713) 20586787 ns/iter (± 24884) 1.00
css/parser/foundation_6_7_4 16541775 ns/iter (± 40042) 16577051 ns/iter (± 69764) 1.00
css/parser/tailwind_3_1_1 3185031 ns/iter (± 3527) 3199868 ns/iter (± 2839) 1.00
es/codegen/colors 738784 ns/iter (± 400782) 740624 ns/iter (± 401173) 1.00
es/codegen/large 3110146 ns/iter (± 1641323) 3120128 ns/iter (± 1635030) 1.00
es/codegen/with-parser/colors 48859 ns/iter (± 331) 48887 ns/iter (± 243) 1.00
es/codegen/with-parser/large 504321 ns/iter (± 691) 521112 ns/iter (± 3305) 0.97
es/minify/libraries/antd 1302678354 ns/iter (± 14998550) 1323790696 ns/iter (± 13689427) 0.98
es/minify/libraries/d3 277902834 ns/iter (± 1178392) 281493184 ns/iter (± 1478748) 0.99
es/minify/libraries/echarts 1047513178 ns/iter (± 7555550) 1056905603 ns/iter (± 7906080) 0.99
es/minify/libraries/jquery 83333834 ns/iter (± 412914) 83551073 ns/iter (± 222946) 1.00
es/minify/libraries/lodash 101865817 ns/iter (± 275935) 102003795 ns/iter (± 212712) 1.00
es/minify/libraries/moment 49219606 ns/iter (± 97923) 49159782 ns/iter (± 97254) 1.00
es/minify/libraries/react 17943495 ns/iter (± 49027) 17846904 ns/iter (± 49528) 1.01
es/minify/libraries/terser 211292198 ns/iter (± 1033950) 213567474 ns/iter (± 840212) 0.99
es/minify/libraries/three 367812815 ns/iter (± 4047044) 372482774 ns/iter (± 1924747) 0.99
es/minify/libraries/typescript 2574660922 ns/iter (± 13227312) 2613162969 ns/iter (± 10441432) 0.99
es/minify/libraries/victory 570946996 ns/iter (± 14268620) 551217447 ns/iter (± 4675303) 1.04
es/minify/libraries/vue 122616641 ns/iter (± 451207) 123457896 ns/iter (± 738900) 0.99
es/visitor/compare/clone 2067940 ns/iter (± 16496) 2079708 ns/iter (± 9511) 0.99
es/visitor/compare/visit_mut_span 2407046 ns/iter (± 6919) 2409416 ns/iter (± 3513) 1.00
es/visitor/compare/visit_mut_span_panic 2444920 ns/iter (± 12299) 2449959 ns/iter (± 2954) 1.00
es/visitor/compare/fold_span 3486198 ns/iter (± 5068) 3488994 ns/iter (± 6413) 1.00
es/visitor/compare/fold_span_panic 3614200 ns/iter (± 5515) 3616746 ns/iter (± 13140) 1.00
es/lexer/colors 13521 ns/iter (± 44) 13087 ns/iter (± 59) 1.03
es/lexer/angular 6253368 ns/iter (± 21015) 6253308 ns/iter (± 10990) 1.00
es/lexer/backbone 835776 ns/iter (± 3141) 818490 ns/iter (± 1710) 1.02
es/lexer/jquery 4650228 ns/iter (± 6084) 4619606 ns/iter (± 3578) 1.01
es/lexer/jquery mobile 7129219 ns/iter (± 13568) 7082083 ns/iter (± 4298) 1.01
es/lexer/mootools 3687183 ns/iter (± 7511) 3654247 ns/iter (± 4146) 1.01
es/lexer/underscore 693761 ns/iter (± 576) 693703 ns/iter (± 859) 1.00
es/lexer/three 21959742 ns/iter (± 31284) 21803955 ns/iter (± 34962) 1.01
es/lexer/yui 4141302 ns/iter (± 3176) 4054871 ns/iter (± 1919) 1.02
es/parser/colors 29295 ns/iter (± 76) 29370 ns/iter (± 93) 1.00
es/parser/angular 14734350 ns/iter (± 97307) 14459825 ns/iter (± 592043) 1.02
es/parser/backbone 2179528 ns/iter (± 7750) 2138656 ns/iter (± 11336) 1.02
es/parser/jquery 11891230 ns/iter (± 58421) 11691667 ns/iter (± 35685) 1.02
es/parser/jquery mobile 18009218 ns/iter (± 108989) 17854597 ns/iter (± 46470) 1.01
es/parser/mootools 9084464 ns/iter (± 30963) 8932900 ns/iter (± 15419) 1.02
es/parser/underscore 1884593 ns/iter (± 9354) 1866976 ns/iter (± 8857) 1.01
es/parser/three 50626049 ns/iter (± 313655) 49498644 ns/iter (± 205186) 1.02
es/parser/yui 9098435 ns/iter (± 26081) 8972468 ns/iter (± 29532) 1.01
es/preset-env/usage/builtin_type 146647 ns/iter (± 32394) 145339 ns/iter (± 31175) 1.01
es/preset-env/usage/property 20782 ns/iter (± 60) 20271 ns/iter (± 54) 1.03
es/resolver/typescript 95208458 ns/iter (± 1831160) 92968979 ns/iter (± 1396577) 1.02
es/fixer/typescript 66892246 ns/iter (± 1387934) 65904892 ns/iter (± 532711) 1.01
es/hygiene/typescript 143957777 ns/iter (± 576859) 141676734 ns/iter (± 1028313) 1.02
es/resolver_with_hygiene/typescript 307328859 ns/iter (± 2110042) 304889704 ns/iter (± 1768070) 1.01
es/visitor/base-perf/module_clone 62379 ns/iter (± 299) 62496 ns/iter (± 256) 1.00
es/visitor/base-perf/fold_empty 65515 ns/iter (± 350) 65583 ns/iter (± 360) 1.00
es/visitor/base-perf/fold_noop_impl_all 65634 ns/iter (± 242) 66216 ns/iter (± 201) 0.99
es/visitor/base-perf/fold_noop_impl_vec 66487 ns/iter (± 345) 66150 ns/iter (± 253) 1.01
es/visitor/base-perf/boxing_boxed_clone 57 ns/iter (± 0) 61 ns/iter (± 0) 0.93
es/visitor/base-perf/boxing_unboxed_clone 41 ns/iter (± 0) 41 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 113 ns/iter (± 0) 119 ns/iter (± 0) 0.95
es/visitor/base-perf/boxing_unboxed 79 ns/iter (± 0) 81 ns/iter (± 0) 0.98
es/visitor/base-perf/visit_empty 0 ns/iter (± 0) 0 ns/iter (± 0) NaN
es/visitor/base-perf/visit_contains_this 2678 ns/iter (± 12) 2680 ns/iter (± 16) 1.00
es/base/parallel/resolver/typescript 4716615597 ns/iter (± 244861078) 4640573954 ns/iter (± 287384549) 1.02
es/base/parallel/hygiene/typescript 1550703889 ns/iter (± 21564894) 1570066256 ns/iter (± 30585886) 0.99
misc/visitors/time-complexity/time 5 104 ns/iter (± 0) 104 ns/iter (± 0) 1
misc/visitors/time-complexity/time 10 267 ns/iter (± 0) 267 ns/iter (± 0) 1
misc/visitors/time-complexity/time 15 503 ns/iter (± 5) 504 ns/iter (± 39) 1.00
misc/visitors/time-complexity/time 20 879 ns/iter (± 55) 1060 ns/iter (± 2) 0.83
misc/visitors/time-complexity/time 40 3541 ns/iter (± 13) 3551 ns/iter (± 204) 1.00
misc/visitors/time-complexity/time 60 7338 ns/iter (± 20) 7538 ns/iter (± 36) 0.97
es/full-target/es2016 241941 ns/iter (± 696) 240264 ns/iter (± 761) 1.01
es/full-target/es2017 227845 ns/iter (± 594) 226490 ns/iter (± 479) 1.01
es/full-target/es2018 216982 ns/iter (± 601) 215160 ns/iter (± 612) 1.01
es2020_nullish_coalescing 73808 ns/iter (± 465) 73550 ns/iter (± 314) 1.00
es2020_optional_chaining 103209 ns/iter (± 410) 103634 ns/iter (± 748) 1.00
es2022_class_properties 122012 ns/iter (± 338) 121562 ns/iter (± 564) 1.00
es2018_object_rest_spread 77169 ns/iter (± 176) 77083 ns/iter (± 326) 1.00
es2019_optional_catch_binding 65559 ns/iter (± 201) 65485 ns/iter (± 137) 1.00
es2017_async_to_generator 66097 ns/iter (± 163) 66259 ns/iter (± 153) 1.00
es2016_exponentiation 71429 ns/iter (± 166) 71392 ns/iter (± 257) 1.00
es2015_arrow 74228 ns/iter (± 381) 73853 ns/iter (± 307) 1.01
es2015_block_scoped_fn 70354 ns/iter (± 208) 70233 ns/iter (± 341) 1.00
es2015_block_scoping 134022 ns/iter (± 387) 134162 ns/iter (± 661) 1.00

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

Please sign in to comment.