From: stelmack@burma.csee.usf.edu (Gregory M. Stelmack)
Subject: Re: Low End 3D (mark 2)
Date: 18 Oct 91 14:40:49 GMT
Organization: University of South Florida, Department of Computer Science 




In article <1991Oct17.003324.11702@demon.co.uk>,
trpw@cix.compulink.co.uk (Tim Watson) writes:

|> I will say this about whether or not to use high level languages.
|> DON'T.
|> One reasons that Jez San et al write such fast code is that they
|> count 
|> almost every instruction cycle in their assembler routines aiming to
|> end up 
|> with as few as possible. Writing at such a low level of course means
|> that
|> they have to know a lot about how the computer and its processor
|> work. High
|> level languages and computer operating systems tend to try to mask
|> off the
|> computer; they also try to be flexible which is not always
|> necessary.

This debate went through the Amiga newsgroups recently, and I will quickly
point out the conclusion reached there: many good C compilers, with the
optimizer turned on, come close enough to a good assembler programmer as
to be indistinguishable. This came out after assembly programmers posted
an assembly algorithm as they would do it, and the C programmers ran the
same thing through their C compilers, and the two were nearly identical!
There was a small cycle-count difference (something like 2 cycles in
a 100-cycle loop) in that particular loop, so you are right -- assembly
programmers can get every last cycle, but they're not winning by much.
And as has already been pointed out here, the high-level programmer can 
spend more time refining the algorithm, and thus maybe execute the
loop fewer times. Conclusion: Assembly programmers make each iteration
of the loop slightly faster, but high-level programmers iterate it
less.

-- Greg Stelmack (stelmack@eggo.csee.usf.edu)
