-
-
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/minifier): Evaluate more
toFixed
expressions (#8109)
- Loading branch information
1 parent
787a465
commit 7da3f52
Showing
9 changed files
with
85 additions
and
110 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
32 changes: 16 additions & 16 deletions
32
crates/swc_ecma_minifier/tests/fixture/issues/6957/1/output.js
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,19 +1,19 @@ | ||
export function foo() { | ||
alert(1..toFixed(1)); | ||
alert("1.0"); | ||
alert("0"); | ||
alert(0..toFixed(1)); | ||
alert(0..toFixed(2)); | ||
alert(0..toFixed(3)); | ||
alert(10..toFixed(1)); | ||
alert(20..toFixed(2)); | ||
alert(30..toFixed(3)); | ||
alert(100..toFixed(1)); | ||
alert(100..toFixed(2)); | ||
alert(100..toFixed(3)); | ||
alert(110..toFixed(1)); | ||
alert(110..toFixed(2)); | ||
alert(110..toFixed(3)); | ||
alert(110..toFixed(4)); | ||
alert(1110..toFixed(4)); | ||
alert(11110..toFixed(4)); | ||
alert("0.0"); | ||
alert("0.00"); | ||
alert("0.000"); | ||
alert("10.0"); | ||
alert("20.00"); | ||
alert("30.000"); | ||
alert("100.0"); | ||
alert("100.00"); | ||
alert("100.000"); | ||
alert("110.0"); | ||
alert("110.00"); | ||
alert("110.000"); | ||
alert("110.0000"); | ||
alert("1110.0000"); | ||
alert("11110.0000"); | ||
} |
4 changes: 2 additions & 2 deletions
4
crates/swc_ecma_minifier/tests/fixture/issues/6957/2/output.js
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 @@ | ||
assertEquals("1", 0.5.toFixed(0), "0.5.toFixed(0)"); | ||
assertEquals("-1", (-0.5).toFixed(0), "(-0.5).toFixed(0)"); | ||
assertEquals("1", "1", "0.5.toFixed(0)"); | ||
assertEquals("-1", "-1", "(-0.5).toFixed(0)"); |
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
7da3f52
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/bugs-1
290281
ns/iter (± 3424
)283618
ns/iter (± 4469
)1.02
es/full/minify/libraries/antd
1416638674
ns/iter (± 21486186
)1422322416
ns/iter (± 8739396
)1.00
es/full/minify/libraries/d3
297774286
ns/iter (± 3440942
)297412872
ns/iter (± 5038966
)1.00
es/full/minify/libraries/echarts
1134630164
ns/iter (± 8866371
)1128557526
ns/iter (± 14480562
)1.01
es/full/minify/libraries/jquery
89532801
ns/iter (± 309873
)88912879
ns/iter (± 190946
)1.01
es/full/minify/libraries/lodash
104753468
ns/iter (± 301989
)103942791
ns/iter (± 218466
)1.01
es/full/minify/libraries/moment
52794327
ns/iter (± 160922
)52264597
ns/iter (± 121762
)1.01
es/full/minify/libraries/react
19047481
ns/iter (± 158342
)18838198
ns/iter (± 63071
)1.01
es/full/minify/libraries/terser
232872722
ns/iter (± 1824743
)232281461
ns/iter (± 1723136
)1.00
es/full/minify/libraries/three
413114866
ns/iter (± 1337935
)415451473
ns/iter (± 2192387
)0.99
es/full/minify/libraries/typescript
2846530066
ns/iter (± 9904541
)2842484338
ns/iter (± 16792163
)1.00
es/full/minify/libraries/victory
609073673
ns/iter (± 3471456
)620651643
ns/iter (± 4743234
)0.98
es/full/minify/libraries/vue
127489727
ns/iter (± 313271
)127009310
ns/iter (± 583293
)1.00
es/full/codegen/es3
33947
ns/iter (± 97
)33808
ns/iter (± 126
)1.00
es/full/codegen/es5
34033
ns/iter (± 90
)33926
ns/iter (± 90
)1.00
es/full/codegen/es2015
34134
ns/iter (± 86
)33808
ns/iter (± 119
)1.01
es/full/codegen/es2016
34034
ns/iter (± 64
)33799
ns/iter (± 142
)1.01
es/full/codegen/es2017
34212
ns/iter (± 108
)33879
ns/iter (± 141
)1.01
es/full/codegen/es2018
34008
ns/iter (± 79
)33838
ns/iter (± 106
)1.01
es/full/codegen/es2019
34039
ns/iter (± 155
)33667
ns/iter (± 73
)1.01
es/full/codegen/es2020
34075
ns/iter (± 108
)33691
ns/iter (± 67
)1.01
es/full/all/es3
174893038
ns/iter (± 919968
)176280263
ns/iter (± 1450696
)0.99
es/full/all/es5
168172736
ns/iter (± 778216
)170809229
ns/iter (± 1506822
)0.98
es/full/all/es2015
127766975
ns/iter (± 614183
)127920746
ns/iter (± 1041117
)1.00
es/full/all/es2016
126209740
ns/iter (± 1007644
)126359371
ns/iter (± 1198604
)1.00
es/full/all/es2017
125854278
ns/iter (± 752301
)126608421
ns/iter (± 1064652
)0.99
es/full/all/es2018
123818878
ns/iter (± 568628
)123814405
ns/iter (± 786046
)1.00
es/full/all/es2019
123363559
ns/iter (± 564297
)123835317
ns/iter (± 1312301
)1.00
es/full/all/es2020
119385734
ns/iter (± 757408
)119921061
ns/iter (± 844210
)1.00
es/full/parser
561227
ns/iter (± 4914
)558607
ns/iter (± 10321
)1.00
es/full/base/fixer
18440
ns/iter (± 194
)17181
ns/iter (± 161
)1.07
es/full/base/resolver_and_hygiene
84587
ns/iter (± 346
)83673
ns/iter (± 269
)1.01
This comment was automatically generated by workflow using github-action-benchmark.