[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a book or tutorial

On Tue, 27 Mar 2001, Mark Collins wrote:

> On a Pentuim the first two instructions would be processed at the same time.
> While a good compiler should notice this, it's no problem doing this
> normally. Now, if you did that in C, chances are you would do:
> r1 = ((r1 + x1) / x2) + (r2 + x2)
> Chances are, a compiler wouldn't take advantage of the optimization if it
> was written in C and not coded too well.

I miss to realize why the language the compiler is coded in makes a
difference. But your example illustrates one of my points anyway. Say you
include the code in a program, and I run a "next generation cpu", and the
stuff you knew about _your_ cpu is not valid on my cpu. By including
assembler you have not given my compiler the choice of optimizing for my

> > By including assembler in code I personally think people behave
> > arrogantly. True, they may experience a speed up compared to their current
> > setup. But, the moment I move to another platform this is lost. Or, if I
> > have a better compiler than they do (as in pgcc/whatever vs gcc) they may
> > have included assembler worse than the assembler my compiler generates.
> If people don't understand assembler abd the architecture they're coding
> for, then yes, it is dangerous to use it. But if you know what you're doing,
> you can increase code efficienct quite alot.

But the tradeoff is that you loose portability. And, you may never
realize that you could improve your code in other ways that would improve
the games speed on other CPU's.


Mads Bondo Dydensborg.                               madsdyd@challenge.dk
I survived the Microsoft marketing holocaust and all I got was this lousy
Windows 2000 t-shirt.

                               - intensity@nerdnet.com

To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk
For additional commands, e-mail: linuxgames-help@sunsite.dk