|
|
>> On some processors counting down to zero is faster than counting up to a
>> specific number.
>
> If you're comparing JIT-compiled Java to purely interpretted Lisp, I
> guarantee you it makes no measurable difference. The overhead of
> everything else outweighs it manytimes over.
Sure, but there are circumstances when it is measureable, like if you are
writing the row-copy code to draw part of a sprite onto the screen.
Actually I remember on my 32bit ARM CPU, if you want to copy a large number
of bytes from a word (32-bit) aligned address to a non-word-aligned address
there were two ways to do it. The first was to just use the load-byte and
store-byte commands, but a way faster method was to load and store words at
a time with some clever bit shifting and masking. Even though the code
looked uglier and longer, it was much faster. Similarly, counting down to
zero saved one clock cycle per loop, and when your loop is only a few clock
cycles and your game is limited by the speed of drawing sprites on the
screen it makes a big difference.
Post a reply to this message
|
|