Mail Archives: djgpp/1997/11/12/15:50:26
Anders Musikka <ajm AT algonet DOT se> wrote:
> >In many ( not all ) cases assembly can be avoided by an author by writing
> >good C/C++ code, by taking short-cuts ( you don't plot every grain of sand
> >on a beach in a 3D enviroment, you plot a hundred or more per pixel, and
> >you only show the surfaces that can be seen from your point of view ) ...
> >Good C++ code may be 10,20, or 50 times slower than good assembly code,
>
> 10,20 or 50 TIMES faster?
>
> That's extreme! I've noticed a difference of maybe 20% for my important
> inner-loops.
And depends on the case, I remmember when I recoded a PCX unpacker in ASM and
got only 6% more of speed. The only way to get 50 times of difference is to
compare a bad C code with a very good ASM code ;-)
> (Check the asm-code a good C compiler produces, it's okay if all
> optimizations are on)
> Some people seem to think there's some kind of magic in
> assembly ("If I write it in assembly it will be a lot faster").
Well, you are right, but some times you can get up to 2 times faster on Pentium
machines if you exploit the 2 pipes to the maximun level. This can be done only
designing an algorithm to make that and coding it in ASM, that what the Quake
engine does ;-).
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -