Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Optimized code

Name: Anonymous 2011-10-18 17:06

which has better run time?

while (x<y) do
something
end

.............

top:
if(x<y) then
something
goto top;
end

Name: Anonymous 2011-10-18 17:08

neither:

if(x>=y)
jmp out
in:
...something
if(x<y) jmp in
out:

Name: Anonymous 2011-10-19 0:59

If you're using a compiled language and not an interpreted one, I'd imagine that these two scenarios would be optimized to the same machine code by the compiler.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List