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

CF: Bitwise vs. integer operations



-----Original Message-----
From: David Andrew Michael Noelle
To: crossfire@ifi.uio.no
Sent: 9/21/99 9:06 PM
Subject: Re: CF: Re: Word of Recall and Portal (was: Prot/chaos, Efficienc
y, and Portals)

> From: dragonm <dragonm@leech.org>
> Date: Tue, 21 Sep 1999 11:55:45 -0700

> Nothing wrong with compulsive optimization, but I still recommend
> doing it using a profiler, rather than assuming things.  As I
> recall, there are several architectures out there where bitwise
> operations are slower than integer operations.

Plese tell me you're kidding.  I never would have suspected that that
was even possible.  My logic and processor design classes certainly
never suggested it.  Why would anyone go out of their way to make the
most inherently trivial operations slower than much more complex
operations?
-----Begin Response-----
No joke.  Bitwise operations don't happen very often compared to integer
operations, so if you go to extraordinary lengths to optimize integer
operations, bitwise operations may suffer.  In point of fact, bitwise
operations are more complex than integer operations.  When a processor's
buses are optimized to transfer every bit in a word at once, transferring a
partial word is actually more difficult.
----------

>  In a memory vs. speed tradeoff where a server is concerned, I'm
> inclined to burn the memory.  Also, because of the multi-platform
> nature of Crossfire, an optimization on one platform may be a severe
> detriment to another platform.  Take it easy with bit-level
> optimizations.

You're right.  I didn't realize there was a tradeoff involved.  I
thought bitwise operations were always at least as fast as integer
operations.  Can anyone give me some more information to back this up?
Perhaps an example of such an architecture?  I'm curious as to how
this is even possible.
-----Begin Response-----
My processor design classes said bit operations are slower than integer
operations on certain Intel CPUs and on MIPS CPUs, and backed it up with
charts.  I haven't actually run benchmarks for myself, and I suppose rather
than discussing the theory, somebody should do so on all the architectures
Crossfire compiles on.  The Pentium III didn't exist back then, so things
may have changed.  Does anybody even run Crossfire on MIPS machines?  :)

DM
-
[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]