TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CHRIS DOWNS
from: HERMAN SCHONFELD
date: 1997-04-09 16:17:00
subject: Re: Video

 HS> Bit shifting will ALWAYS be faster than multiplying.
 MW>According to a book I am reading right now. Bit shifting is faster
CD>by a
 MW>factor of around 3 times. You just have to be careful if you shift
CD>too
 MW>far you may lose significant bits. :-(
 HS> My point exactly, you should forward this message to the Chris
CD>Downs.
CD>No.  The point was made that substituting a multiply with two bit shifts
CD>and two adds makes for a performance plus.
CD>The problem is that I've bench marked it.  Counting cycles
CD>is not a satisfactory substitute.  The add/bit shift has more code.  Did
CD>you count the cycles needed to load the code into the instruction
CD>pipeline (for example)???
CD>It's _so_simple_ to get the exact answer by running such a simple test.
CD>I *know* that substituting an bit shifts/adds for an integer multiply
CD>on a 386 is a performance loser.  (Because I tested it) I also know that
CD>substituting a bit shift for a multiply by a constant power of two is a
CD>waste of effort for every compiler I use.  (Again because I tested it.)
CD>Since I don't like to play lose/lose scenarios, I'll pass on the above
CD>advice.  (But I certainly can be swayed by reliable evidence.  How
CD>about bench marking your performace "improvements" and supplying
CD>us with the results??  It would be quite educational!)
i dont even use shifts, i just use a pre-computed look-up table.
... Computer programmers wanted - Some assembly required.
--- Ezycom V1.48g0 01fd016b
---------------
* Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.