[Slackers] conditional performance
Jaymz Julian
jaymz at artificial-stupidity.net
Tue Apr 18 04:17:27 CDT 2006
On Mon, Apr 17, 2006 at 07:49:50PM -0600, Steve Judd wrote:
> The first one assembles to
>
> lda a
> bne :skip
> lda b
> bne :skip
> inc $d020
> :skip
>
> while the first one is
>
> lda a
> and b
> bne :skip
>
> (which assumes a and b are logical 1 or 0 -- if a=1 and b=2 the branch
> won't be taken, for example.)
>
> (Note, by the way, that parethesis aren't required.)
Yeah, in my case the first piece of code is actually preferable in a lot
of cases, since my if statements are complicated - stuff like
if(enemy(y)=pY) and (enemyx(y)=px) ends up being quicker if it doesn't
have to do the second lookup 70%+ of the time :)
--jj
--
--
Jaymz Julian - Coder, Visionary, Fat Ass.
"Hannibal is a serial killer. He only likes to kill and eat people.
Very few people have `I want to be killed and eaten' on their cards,
so Hannibal is out of a job." - http://cards.sf.net
More information about the Slackers
mailing list