4 ms·
I'll have a look for the discussion. Any idea if the branches are more expensive than some multiplies? step = (a<=b)?1:-1; for (i = a; step*i < step*b;
by repsilat 15y ago
I'll have a look for the discussion. Any idea if the branches are more expensive than some multiplies?
step = (a<=b)?1:-1;
for (i = a; step*i < step*b; i += step) {
doSomething();
}
I guess if the branch predictor is any good it could be slower with multiplies, but I have no idea what to expect in a dynamic language.