Re: High Level Language vs Assembly

henry@spsystems.net (Henry Spencer)
25 Feb 2001 23:28:57 -0500

          From comp.compilers

Related articles
[6 earlier articles]
Re: High Level Language vs Assembly walter@bytecraft.com (Walter Banks) (2001-02-25)
Re: High Level Language vs Assembly walter@bytecraft.com (Walter Banks) (2001-02-25)
Re: High Level Language vs Assembly rhyde@transdimension.com (Randall Hyde) (2001-02-25)
Re: High Level Language vs Assembly max@max.mcs.gac.edu (Max Hailperin) (2001-02-25)
Re: High Level Language vs Assembly jacob@jacob.remcomp.fr (jacob navia) (2001-02-25)
Re: High Level Language vs Assembly tej@melbpc.org.au (Tim Josling) (2001-02-25)
Re: High Level Language vs Assembly henry@spsystems.net (2001-02-25)
Re: High Level Language vs Assembly fjh@cs.mu.OZ.AU (2001-02-25)
Re: High Level Language vs Assembly ts3@ukc.ac.uk (T.Shackell) (2001-03-01)
Re: High Level Language vs Assembly samiam@cisco.com (Scott Moore) (2001-03-01)
Re: High Level Language vs Assembly samiam@cisco.com (Scott Moore) (2001-03-04)
Re: High Level Language vs Assembly sunni@speakeasy.net (Shankar Unni) (2001-03-04)
Re: High Level Language vs Assembly ts3@ukc.ac.uk (T.Shackell) (2001-03-08)
[12 later articles]
| List of all articles for this month |

From: henry@spsystems.net (Henry Spencer)
Newsgroups: comp.compilers
Date: 25 Feb 2001 23:28:57 -0500
Organization: SP Systems, Toronto, Canada
References: 01-02-094 01-02-101 01-02-138
Keywords: assembler, performance
Posted-Date: 25 Feb 2001 23:28:56 EST

In article 01-02-138,
jacob navia <jacob@jacob.remcomp.fr> wrote:
>A compiler must be correct for all cases. This means that will never
>be as clever as the programmer doing a concrete program.


Often cleverness is less important than bookkeeping ability. A
compiler can remember, and track the implications of, unlimited
volumes of clerical detail. This means it will often be able to
optimize better than a programmer.


The programmer necessarily has to write a *family* of programs. His
inability to handle massive detail easily means that large-scale
rethinking for every change is impractical. The inevitable small
changes during debugging and testing must not bring the whole thing
down like a house of cards.


The compiler can, and does, start from scratch every time, optimizing
that *exact* program as thoroughly as it can, with no need to be
concerned about vulnerability to small changes.


>Take for instance a routine that uses often a global variable. A human
>assembly programmer, knowing the use of the variable in the program,
>can cache that in a register. The compiler can't since it could be in
>principle modified by another thread. It must generate code to read it
>each time from RAM.


Modern compilers can, and do, cache such things in registers... unless
they are declared "volatile", which is how you tell the compiler that
the variable is subject to behind-the-scenes changes.


>I like assembly. For instance, I discovered that generating in-line a
>loop to replace strlen is actually smaller in code size, than the call
>itself!


Poor compiler you've got there. Good ones will inline strlen if that is
a win. It has never been the least bit difficult for an assembler
programmer to beat a poor compiler.
--
When failure is not an option, success | Henry Spencer henry@spsystems.net
can get expensive. -- Peter Stibrany | (aka henry@zoo.toronto.edu)


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.