Comma
Closed this issue · 1 comments
837951602 commented
- [Said]Array slice on the two(or more if the middle part has exactly 1 char) adjacent chars
JScrewIt.encode('"0,00,0"',{features:['FILL','NO_IE_SRC']}).length = 766
JScrewIt.encode('[0].concat(0)+[0].concat(0)',{features:['FILL','NO_IE_SRC']}).length = 763
- In output.txt
391 | 1 | FILL, IE_SRC
but when I run in it's 394. [Update]Ok I know that's because WITHOUT +[] ITS 391
fasttime commented
This kind of optimization has been removed in JScrewIt 2.17.0 because it doesn't improve encoding length in the current versions of any engines.
The old concat
bridge optimization was added to JScrewIt before a generic optimizer framework existed, and so it suffered from some design complications that would make it impossible for me to improve the existing implementation without rewriting the code from scratch.
Anyway, a new comma optimizer produces much better results in all new engines:
JScrewIt.encode('[0].concat(0)+[0].concat(0)', { features: 'COMPACT' }).length // 661
JScrewIt.encode('"0,00,0"', { features: 'COMPACT' }).length // 453
That is here [].flat.call("00")+[].flat.call("00")
(or [].slice.call("00")+[].slice.call("00")
if flat
is not available).