-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es/modules): Optimize a dynamic import with a literal path (#5049)
- Loading branch information
1 parent
48c562a
commit 2cc229e
Showing
7 changed files
with
40 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/fixture/common/issue-1018/1/output.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
"use strict"; | ||
async function foo() { | ||
await Promise.resolve("foo").then((p)=>_interopRequireWildcard(require(p))); | ||
await Promise.resolve().then(()=>_interopRequireWildcard(require("foo"))); | ||
} |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/fixture/common/issue-1480/1/output.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
"use strict"; | ||
const { default: ora } = await Promise.resolve("ora").then((p)=>_interopRequireWildcard(require(p))); | ||
const { default: ora } = await Promise.resolve().then(()=>_interopRequireWildcard(require("ora"))); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_transforms_module/tests/fixture/common/issue-1614/1/output.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"use strict"; | ||
(async ()=>{ | ||
const example = await Promise.resolve("./example").then((p)=>_interopRequireWildcard(require(p))); | ||
const example = await Promise.resolve().then(()=>_interopRequireWildcard(require("./example"))); | ||
console.log(example.foo); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2cc229e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/minify/libraries/antd
1652252108
ns/iter (± 57653031
)1768503220
ns/iter (± 45264695
)0.93
es/full/minify/libraries/d3
412703254
ns/iter (± 23407654
)440754679
ns/iter (± 11774964
)0.94
es/full/minify/libraries/echarts
1631744625
ns/iter (± 35487374
)1723654422
ns/iter (± 46910408
)0.95
es/full/minify/libraries/jquery
97847070
ns/iter (± 7492554
)96344107
ns/iter (± 6168313
)1.02
es/full/minify/libraries/lodash
123068302
ns/iter (± 6507436
)127560655
ns/iter (± 3612056
)0.96
es/full/minify/libraries/moment
56658187
ns/iter (± 3900277
)56223510
ns/iter (± 1713824
)1.01
es/full/minify/libraries/react
18185462
ns/iter (± 302239
)19298885
ns/iter (± 549665
)0.94
es/full/minify/libraries/terser
628247895
ns/iter (± 8911334
)641148488
ns/iter (± 24182313
)0.98
es/full/minify/libraries/three
564978863
ns/iter (± 15134602
)588860031
ns/iter (± 17919401
)0.96
es/full/minify/libraries/typescript
3393544763
ns/iter (± 50370372
)3696982153
ns/iter (± 74914336
)0.92
es/full/minify/libraries/victory
705208985
ns/iter (± 9701178
)794959798
ns/iter (± 20411868
)0.89
es/full/minify/libraries/vue
128389896
ns/iter (± 4507634
)147111296
ns/iter (± 2697669
)0.87
es/full/codegen/es3
31873
ns/iter (± 976
)32511
ns/iter (± 1342
)0.98
es/full/codegen/es5
31840
ns/iter (± 927
)32937
ns/iter (± 3698
)0.97
es/full/codegen/es2015
31794
ns/iter (± 2448
)32931
ns/iter (± 1919
)0.97
es/full/codegen/es2016
32583
ns/iter (± 368
)33727
ns/iter (± 3518
)0.97
es/full/codegen/es2017
32417
ns/iter (± 573
)33791
ns/iter (± 5653
)0.96
es/full/codegen/es2018
31422
ns/iter (± 1029
)32937
ns/iter (± 1260
)0.95
es/full/codegen/es2019
31741
ns/iter (± 1402
)31921
ns/iter (± 1693
)0.99
es/full/codegen/es2020
31373
ns/iter (± 1113
)33480
ns/iter (± 5750
)0.94
es/full/all/es3
181481338
ns/iter (± 6201831
)195465130
ns/iter (± 9145060
)0.93
es/full/all/es5
170745988
ns/iter (± 4632753
)197848024
ns/iter (± 16625473
)0.86
es/full/all/es2015
139280555
ns/iter (± 10191271
)157281428
ns/iter (± 12746581
)0.89
es/full/all/es2016
137891669
ns/iter (± 4471545
)141646103
ns/iter (± 7558668
)0.97
es/full/all/es2017
137105788
ns/iter (± 5195260
)140424429
ns/iter (± 5382066
)0.98
es/full/all/es2018
136495277
ns/iter (± 4634623
)138375042
ns/iter (± 4065629
)0.99
es/full/all/es2019
135530630
ns/iter (± 4879329
)137951083
ns/iter (± 4145257
)0.98
es/full/all/es2020
134624354
ns/iter (± 5575736
)141799983
ns/iter (± 8338628
)0.95
es/full/parser
709810
ns/iter (± 21013
)739714
ns/iter (± 38094
)0.96
es/full/base/fixer
29141
ns/iter (± 977
)29709
ns/iter (± 1580
)0.98
es/full/base/resolver_and_hygiene
86752
ns/iter (± 3025
)90176
ns/iter (± 3474
)0.96
serialization of ast node
206
ns/iter (± 4
)218
ns/iter (± 12
)0.94
serialization of serde
210
ns/iter (± 4
)232
ns/iter (± 16
)0.91
This comment was automatically generated by workflow using github-action-benchmark.