You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see lots of unnecessary local variables which make the program harder to understand and larger.
In the following example code, char goes all the way to char11.
All of the ssa names are superfluous. Using the root name reduced the code size from 66 lines to 54 and 1969 bytes to 1639 - 17%
Obviously, this only happens in code that has mutable local variables so the global saving would be less, but the code would be more comprehensible.
_lib11_parseNumber$0: function() {
if (this._lib11_isToken$1(45) !== true) {
this._lib11_error$1('Expected number literal');
}
var startPos = this.position;
var char$ = this._lib11_char$0();
var char0 = char$;
if (char$ === 45) {
char0 = this._lib11_nextChar$0();
}
if (char0 === 48) {
var char1 = this._lib11_nextChar$0();
} else {
if (this._lib11_isDigit$1(char0) === true) {
for (var char2 = this._lib11_nextChar$0(); this._lib11_isDigit$1(char2) === true; char2 = char3) {
char3 = char2;
char3 = this._lib11_nextChar$0();
}
char1 = char2;
} else {
this._lib11_error$1('Expected digit when parsing number');
char1 = char0;
}
}
var char4 = char1;
var isInt = true;
if (char1 === 46) {
var char5 = this._lib11_nextChar$0();
if (this._lib11_isDigit$1(char5) === true) {
for (var char6 = this._lib11_nextChar$0(); this._lib11_isDigit$1(char6) === true; char6 = char7) {
char7 = char6;
char7 = this._lib11_nextChar$0();
}
char4 = char6;
isInt = false;
} else {
this._lib11_error$1('Expected digit following comma');
char4 = char5;
isInt = true;
}
}
var isInt0 = isInt;
if (char4 === 101 || char4 === 69) {
var char8 = this._lib11_nextChar$0();
var char9 = char8;
if (char8 === 45 || char8 === 43) {
char9 = this._lib11_nextChar$0();
}
if (this._lib11_isDigit$1(char9) === true) {
for (var char10 = this._lib11_nextChar$0(); this._lib11_isDigit$1(char10) === true; char10 = char11) {
char11 = char10;
char11 = this._lib11_nextChar$0();
}
isInt0 = false;
} else {
this._lib11_error$1('Expected digit following 'e' or 'E'');
isInt0 = isInt;
}
}
var number = $.substring$2(this.json, startPos, this.position);
if (isInt0) {
return $.parseInt(number);
} else {
return $.parseDouble(number);
}
},
The text was updated successfully, but these errors were encountered:
I see lots of unnecessary local variables which make the program harder to understand and larger.
In the following example code, char goes all the way to char11.
All of the ssa names are superfluous. Using the root name reduced the code size from 66 lines to 54 and 1969 bytes to 1639 - 17%
Obviously, this only happens in code that has mutable local variables so the global saving would be less, but the code would be more comprehensible.
_lib11_parseNumber$0: function() {
if (this._lib11_isToken$1(45) !== true) {
this._lib11_error$1('Expected number literal');
}
var startPos = this.position;
var char$ = this._lib11_char$0();
var char0 = char$;
if (char$ === 45) {
char0 = this._lib11_nextChar$0();
}
if (char0 === 48) {
var char1 = this._lib11_nextChar$0();
} else {
if (this._lib11_isDigit$1(char0) === true) {
for (var char2 = this._lib11_nextChar$0(); this._lib11_isDigit$1(char2) === true; char2 = char3) {
char3 = char2;
char3 = this._lib11_nextChar$0();
}
char1 = char2;
} else {
this._lib11_error$1('Expected digit when parsing number');
char1 = char0;
}
}
var char4 = char1;
var isInt = true;
if (char1 === 46) {
var char5 = this._lib11_nextChar$0();
if (this._lib11_isDigit$1(char5) === true) {
for (var char6 = this._lib11_nextChar$0(); this._lib11_isDigit$1(char6) === true; char6 = char7) {
char7 = char6;
char7 = this._lib11_nextChar$0();
}
char4 = char6;
isInt = false;
} else {
this._lib11_error$1('Expected digit following comma');
char4 = char5;
isInt = true;
}
}
var isInt0 = isInt;
if (char4 === 101 || char4 === 69) {
var char8 = this._lib11_nextChar$0();
var char9 = char8;
if (char8 === 45 || char8 === 43) {
char9 = this._lib11_nextChar$0();
}
if (this._lib11_isDigit$1(char9) === true) {
for (var char10 = this._lib11_nextChar$0(); this._lib11_isDigit$1(char10) === true; char10 = char11) {
char11 = char10;
char11 = this._lib11_nextChar$0();
}
isInt0 = false;
} else {
this._lib11_error$1('Expected digit following 'e' or 'E'');
isInt0 = isInt;
}
}
var number = $.substring$2(this.json, startPos, this.position);
if (isInt0) {
return $.parseInt(number);
} else {
return $.parseDouble(number);
}
},
The text was updated successfully, but these errors were encountered: