Message-ID: <3469E8A5.190A@algonet.se> Date: Wed, 12 Nov 1997 18:34:29 +0100 From: Anders Musikka Reply-To: ajm AT algonet DOT se MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: reply to: low level programming necesary? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk >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. (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"). There isn't! Fast C++ code will be allmost as fast as good assembly code (maybe 10% difference on average). Some people seem to think that assembly is needed to convert array-walks to pointer walks: don't write: i++;x=myarray[i]; write like this instead: myarraypointer++; x=*myarraypointer; >learn assembly ( or vice versa ). Just don't try to learn floating point >in assembly, no matter what anyone says I feel it is a pain in the ass. Hmm... it's not THAT bad on a 80386 compatible machine, is it? ... it's like a HP pocket calculator (fld [X] fld [Y] fmul fstp [answer] this is equivalent to: answer=X*Y) In my oppinion Protected Mode interrupt- and exception-handling is a lot more difficult (I've done it)