Predefinition:
Runaway counter increased only in two VM tokens: Jump and JumpIfNot.
All stated matter only for bottle necks which make main part of runaway limit. No sense apply this to any code.
Code: Select all
for (i = 0; i < RUNAWAY_LIMIT; i++) {
if (A) {
B = true;
continue;
}
C = true;
}
Code: Select all
for (i = 0; i < RUNAWAY_LIMIT; i++) {
if (A) {
B = true;
} else {
C = true;
}
}
2. Travel via block after if eat 4 points per iteration: for condition, if, continue/end block, jump at loop end.
Travel via block after else eat 3 points per iteration: for condition, if, jump loop.
So better, place things which come often in else block.
Code: Select all
for (i = 0; i < RUNAWAY_LIMIT; i++) {
if (A) {
B = true;
}
}
Code: Select all
for (i = 0; i < RUNAWAY_LIMIT; i++) {
if (!A)
continue;
B = true;
}
But second eat 4 point per iteration if "continue" called.