TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: NIELS JONKER
from: CHRIS DOWNS
date: 1997-04-10 10:38:00
subject: Re: Video

 CD> It would be easy enough to benchmark the code and that's the _only_ way
 CD> you could get a good answer to the question. 
 NJ> Indeed you're right, so I coded a little bit to do this.
 NJ> I tried it on a pentium 60 compiled for DOS 16 bit with BC 4.02 with 
 NJ> various optimization switches, in each case the shifts were quitte a
 NJ> bit faster then the multiplication.
 Interesting.  I tested your code with VC++ 4.2 on a pentium (I didn't
 play around with any optimization switches other than testing release
 and debug versions) and the the bit shift code reported the exact same
 execution time as did the multiply version!  (Which is an improvement
 over QC with a 386 where the bit shift code was a big performance dog.)
 One inescapable conclusion is that the assertion that "bit shifting
 is _always_ faster than multiplication" is false.  However, if you
 are using a compiler that is notoriously poor in the optimization/
 execution speed department (ie Borland), such code obfuscation tricks
 may well be justified.
 
---
 þ Blue Wave/QWK v2.12 þ
---------------
* Origin: St. Louis Users Group (1:100/4)

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™.