Reply-To: From: "Arthur" To: "DJGPP Mailing List" Subject: RE: should i bother learning asm?? or just learn dx? Date: Sun, 9 Aug 1998 12:38:52 +0100 Message-ID: <000201bdc38a$48725ec0$ab4d08c3@arthur> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Importance: Normal In-Reply-To: <6qfbov$bv1$1@star.cs.vu.nl> Precedence: bulk > Arthur wrote: > > ASM is the cream of programming languages. It should be what you > > always aspire to. However *alas* virtually no game nowadays is pure > > ASM. What you should do (or what most people do) is get your game > > working in C/C++ and add processor-heavy features (such as graphics) > > in ASM. > > > Remember always, no matter what anyone else says, that any language > > (including C) will never be as fast as the same code in optimised > > ASM. It is just not possible. > > But it is possible that the compiler (i.e. GCC) optimizes your > function in C better than you could think off. That's why you should, > IMHO, first profile your speed-critical application, and then _try_ to > optimize in ASM the parts you _think_ can (and should) go faster. > GCC does a lot in aligning, instruction ordering and other things for > your CPU, if you give it the right options. GCC is good at optimising, but the way that C is structured, a fully optimised program will still not be as optimised as one written in ASM from scratch. For instance, writing a simple "hello world" program in DJGPP will produce code ~50k in size with full optimisation. In ASM, you can get it down to less ahan 5k. I once wrote a program which was 7k long in ASM. The same program in DJGPP was 80k with -O3 and -s on. > PS. this is not intended to start a (flame)war between C/C++ and ASM > coders, but it's just to clarify some more. And I think it's not > _necessary_ to know ASM to be a good (game) coder, although I am > sure it will be very usefull if you do. No it's not necessary, and on the PC it's very hard to learn. But note that professional programmers use hand-optimised ASM frequently - especially in graphics code and interrupt routines. The Allegro library uses ASM to get some of its routines up to speed, as do many other libs. James Arthur jaa AT arfa DOT clara DOT net ICQ#15054819