-
-
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.
fix(es/minifier): Preserve op of the op-assignments in seq inliner (#…
- Loading branch information
Showing
24 changed files
with
275 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"minify": false, | ||
"jsc": { | ||
"parser": { | ||
"syntax": "ecmascript" | ||
}, | ||
"transform": { | ||
"legacyDecorator": true, | ||
"react": { | ||
"runtime": "automatic" | ||
} | ||
}, | ||
"target": "es2022", | ||
"loose": false, | ||
"externalHelpers": true, | ||
"minify": { | ||
"compress": { | ||
"arguments": false, | ||
"arrows": true, | ||
"booleans": true, | ||
"booleans_as_integers": false, | ||
"collapse_vars": true, | ||
"comparisons": true, | ||
"computed_props": true, | ||
"conditionals": true, | ||
"dead_code": true, | ||
"directives": true, | ||
"drop_console": false, | ||
"drop_debugger": true, | ||
"evaluate": true, | ||
"expression": false, | ||
"hoist_funs": false, | ||
"hoist_props": true, | ||
"hoist_vars": false, | ||
"if_return": true, | ||
"join_vars": true, | ||
"keep_classnames": false, | ||
"keep_fargs": true, | ||
"keep_fnames": false, | ||
"keep_infinity": false, | ||
"loops": true, | ||
"negate_iife": true, | ||
"properties": true, | ||
"reduce_funcs": false, | ||
"reduce_vars": false, | ||
"side_effects": true, | ||
"switches": true, | ||
"typeofs": true, | ||
"unsafe": false, | ||
"unsafe_arrows": false, | ||
"unsafe_comps": false, | ||
"unsafe_Function": false, | ||
"unsafe_math": false, | ||
"unsafe_symbols": false, | ||
"unsafe_methods": false, | ||
"unsafe_proto": false, | ||
"unsafe_regexp": false, | ||
"unsafe_undefined": false, | ||
"unused": true, | ||
"const_to_let": true, | ||
"pristine_globals": true | ||
}, | ||
"mangle": false | ||
} | ||
}, | ||
"module": { | ||
"type": "es6" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export default class Demo { | ||
static encode(value) { | ||
const ranges = []; | ||
let range = []; | ||
let retrString = A.encode(value); | ||
let bitField = ''; | ||
value.forEach((curValue, i) => { | ||
bitField += B.encode(curValue); | ||
range.push(i); | ||
ranges.push(range); | ||
}); | ||
retrString += '.'; | ||
retrString += C.encode(ranges); | ||
return retrString; | ||
} | ||
} | ||
|
||
console.log(Deno.encode()) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default class Demo { | ||
static encode(value) { | ||
let ranges = [], range = [], retrString = A.encode(value), bitField = ''; | ||
return value.forEach((curValue, i)=>{ | ||
bitField += B.encode(curValue), range.push(i), ranges.push(range); | ||
}), retrString += '.' + C.encode(ranges); | ||
} | ||
} | ||
console.log(Deno.encode()); |
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,3 +1,3 @@ | ||
//// [symbolType12.ts] | ||
var s = Symbol.for("assign"), str = ""; | ||
s *= 0, s /= s, s /= 0, s %= s, s %= 0, str += s = s + 0 + "", s -= s, s -= 0, s <<= s, s <<= 0, s >>= s, s >>= 0, s >>>= s, s >>>= 0, s &= s, s &= 0, s ^= s, s ^= 0, s |= s, s |= 0, str += s || str; | ||
s *= 0 * s, s /= s, s /= 0, s %= s, s %= 0, s += s + 0 + "", str += s, s -= s, s -= 0, s <<= s, s <<= 0, s >>= s, s >>= 0, s >>>= s, s >>>= 0, s &= s, s &= 0, s ^= s, s ^= 0, s |= s, s |= 0, str += s || str; |
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 |
---|---|---|
|
@@ -2305,7 +2305,7 @@ where | |
); | ||
self.changed = true; | ||
|
||
b.op = op!("="); | ||
b.op = a_op; | ||
|
||
let to = take_a!(true, true); | ||
|
||
|
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
46 changes: 46 additions & 0 deletions
46
crates/swc_ecma_minifier/tests/fixture/issues/6407/1/config.json
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"arguments": false, | ||
"arrows": true, | ||
"booleans": true, | ||
"booleans_as_integers": false, | ||
"collapse_vars": true, | ||
"comparisons": true, | ||
"computed_props": true, | ||
"conditionals": true, | ||
"dead_code": true, | ||
"directives": true, | ||
"drop_console": false, | ||
"drop_debugger": true, | ||
"evaluate": true, | ||
"expression": false, | ||
"hoist_funs": false, | ||
"hoist_props": true, | ||
"hoist_vars": false, | ||
"if_return": true, | ||
"join_vars": true, | ||
"keep_classnames": false, | ||
"keep_fargs": true, | ||
"keep_fnames": false, | ||
"keep_infinity": false, | ||
"loops": true, | ||
"negate_iife": true, | ||
"properties": true, | ||
"reduce_funcs": false, | ||
"reduce_vars": false, | ||
"side_effects": true, | ||
"switches": true, | ||
"typeofs": true, | ||
"unsafe": false, | ||
"unsafe_arrows": false, | ||
"unsafe_comps": false, | ||
"unsafe_Function": false, | ||
"unsafe_math": false, | ||
"unsafe_symbols": false, | ||
"unsafe_methods": false, | ||
"unsafe_proto": false, | ||
"unsafe_regexp": false, | ||
"unsafe_undefined": false, | ||
"unused": true, | ||
"const_to_let": true, | ||
"pristine_globals": true | ||
} |
18 changes: 18 additions & 0 deletions
18
crates/swc_ecma_minifier/tests/fixture/issues/6407/1/input.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export default class Demo { | ||
static encode(value) { | ||
const ranges = []; | ||
let range = []; | ||
let retrString = A.encode(value); | ||
let bitField = ''; | ||
value.forEach((curValue, i) => { | ||
bitField += B.encode(curValue); | ||
range.push(i); | ||
ranges.push(range); | ||
}); | ||
retrString += '.'; | ||
retrString += C.encode(ranges); | ||
return retrString; | ||
} | ||
} | ||
|
||
console.log(Deno.encode()) |
12 changes: 12 additions & 0 deletions
12
crates/swc_ecma_minifier/tests/fixture/issues/6407/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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default class Demo { | ||
static encode(value) { | ||
const ranges = []; | ||
let range = [], retrString = A.encode(value), bitField = ''; | ||
return value.forEach((curValue, i)=>{ | ||
bitField += B.encode(curValue); | ||
range.push(i); | ||
ranges.push(range); | ||
}), retrString += '.' + C.encode(ranges); | ||
} | ||
} | ||
console.log(Deno.encode()); |
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
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
Oops, something went wrong.
5fd7ab8
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
384386
ns/iter (± 27258
)359764
ns/iter (± 35638
)1.07
es/full/minify/libraries/antd
2157855976
ns/iter (± 154647760
)1859260645
ns/iter (± 50064656
)1.16
es/full/minify/libraries/d3
507326098
ns/iter (± 43450517
)407449725
ns/iter (± 22362328
)1.25
es/full/minify/libraries/echarts
1824283509
ns/iter (± 87224373
)1612858764
ns/iter (± 52492529
)1.13
es/full/minify/libraries/jquery
125674262
ns/iter (± 10270302
)100909663
ns/iter (± 11908356
)1.25
es/full/minify/libraries/lodash
161841571
ns/iter (± 23767299
)134324510
ns/iter (± 10291658
)1.20
es/full/minify/libraries/moment
68607780
ns/iter (± 9180227
)67175152
ns/iter (± 8010933
)1.02
es/full/minify/libraries/react
25933890
ns/iter (± 4050584
)21767308
ns/iter (± 633949
)1.19
es/full/minify/libraries/terser
350526660
ns/iter (± 27602752
)318945153
ns/iter (± 12126350
)1.10
es/full/minify/libraries/three
623627713
ns/iter (± 11338445
)575525366
ns/iter (± 33154379
)1.08
es/full/minify/libraries/typescript
3761569636
ns/iter (± 115227394
)3525404089
ns/iter (± 93756360
)1.07
es/full/minify/libraries/victory
911504195
ns/iter (± 73599321
)854009311
ns/iter (± 18508124
)1.07
es/full/minify/libraries/vue
185860561
ns/iter (± 21242771
)186769157
ns/iter (± 10795873
)1.00
es/full/codegen/es3
46380
ns/iter (± 14989
)35987
ns/iter (± 2947
)1.29
es/full/codegen/es5
40437
ns/iter (± 8242
)35271
ns/iter (± 2919
)1.15
es/full/codegen/es2015
39676
ns/iter (± 8266
)35398
ns/iter (± 2191
)1.12
es/full/codegen/es2016
37263
ns/iter (± 6019
)35354
ns/iter (± 3173
)1.05
es/full/codegen/es2017
40107
ns/iter (± 7901
)35284
ns/iter (± 2622
)1.14
es/full/codegen/es2018
38133
ns/iter (± 7170
)35578
ns/iter (± 4212
)1.07
es/full/codegen/es2019
40487
ns/iter (± 6505
)35800
ns/iter (± 3202
)1.13
es/full/codegen/es2020
42072
ns/iter (± 6483
)35466
ns/iter (± 3811
)1.19
es/full/all/es3
265106839
ns/iter (± 38190047
)217580563
ns/iter (± 21596484
)1.22
es/full/all/es5
244142811
ns/iter (± 32437808
)185495295
ns/iter (± 15440090
)1.32
es/full/all/es2015
192458130
ns/iter (± 34969575
)162503849
ns/iter (± 17551828
)1.18
es/full/all/es2016
198876122
ns/iter (± 26085312
)155546701
ns/iter (± 21213081
)1.28
es/full/all/es2017
195382082
ns/iter (± 25498989
)165784208
ns/iter (± 18397331
)1.18
es/full/all/es2018
188338284
ns/iter (± 37307217
)160782944
ns/iter (± 18813240
)1.17
es/full/all/es2019
188593759
ns/iter (± 26596396
)149664700
ns/iter (± 11898224
)1.26
es/full/all/es2020
173921773
ns/iter (± 27236630
)147589823
ns/iter (± 12281102
)1.18
es/full/parser
862147
ns/iter (± 109307
)752944
ns/iter (± 74353
)1.15
es/full/base/fixer
31531
ns/iter (± 4793
)27952
ns/iter (± 3623
)1.13
es/full/base/resolver_and_hygiene
110707
ns/iter (± 15719
)95506
ns/iter (± 8627
)1.16
serialization of ast node
248
ns/iter (± 51
)215
ns/iter (± 3
)1.15
serialization of serde
248
ns/iter (± 43
)228
ns/iter (± 24
)1.09
This comment was automatically generated by workflow using github-action-benchmark.