Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: Re: Word of Recall and Portal (was: Prot/chaos, Efficiency, and Portals)



> From: "Nicolas Loechner" <loechner@zenon-media.com>
> Date: Wed, 22 Sep 1999 09:46:40 +0100
> 
> Bitwise operations first require access to the data, then the
> operation itself, then handling the result... Takes 2 more CPU cycles.
> Wow now we are optimizing to the CPU cycle...

Oh, you meant bitwise operations are slower than *no* operation.
Well, yeah.  It's one cycle faster to load a value and test whether
it's zero than to load a value, pick out one bit, and test whether
that's zero.  There's no integer operation involved.  I was going to
say that there might be an integer operation in constructing the
bitmask, but in many cases, that's a constant that any decent
compiler would reduce to a single instruction with no memory access.

At the level we're talking about here, optimization is more about what
the operations are than how many there are.  If multiple flags are
being checked, the data would have to be loaded into the processor
less often with bitmasks because the value could just be held in a
register while it's being tested instead of loading a new value for
each test.  And if a lot of flags are being tested, your cache
hit/miss ratio would most likely be better, which saves lots of time.

But all of this is way too minute to be worrying about for flag tests
on Crossfire's map structures.  There aren't enough maps loaded
simultaneously, nor are the tests being done frequently enough, to
make a measurable difference in either memory or speed.


> I would optimize memory without an hesitation though.

That's what I was thinking when I made the comment.  Right now, there
are only three flags, so it really doesn't make a difference, but I
was adding more at the time, specifically that "portal safe" flag, and
thinking about the tendency of such lists to grow into something
significant over time, like the object flags apparently have.  I knew
I was overreacting, and stated as much in my message.  Not only is it
pointless to optimize a few numbers in an uncommon structure, it's
irrelevant.  That structure is likely to change soon anyway.

Individual cycles and a handful of bytes are much too small to worry
about, especially at this point in the development.

-- 
            -Dave Noelle,                 dave@Straylight.org
            -the Villa Straylight,  http://www.straylight.org
Coalition Against Unsolicited Commercial Email  ==  http://www.cauce.com

Quote of the Day:
"'This will end your Windows session.'  I live for those six words."
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]