Re: Assembly verses a high-level language.

bobduff@world.std.com (Robert A Duff)
Tue, 28 Nov 1995 16:12:49 GMT

          From comp.compilers

Related articles
Assembly verses a high-level language. tomviper@ix.netcom.com (1995-11-20)
Re: Assembly verses a high-level language. macrakis@osf.org (1995-11-22)
Re: Assembly verses a high-level language. bobduff@world.std.com (1995-11-28)
Re: Assembly verses a high-level language. marcus@illusion.magicno.com (1995-11-29)
Re: Assembly verses a high-level language. Graham.Matthews@pell.anu.edu.au (Graham Matthews) (1995-11-29)
Re: Assembly verses a high-level language. john_reiser@MENTORG.COM (1995-12-09)
Re: Assembly verses a high-level language. albaugh@agames.com (1995-12-09)
| List of all articles for this month |
Newsgroups: comp.compilers
From: bobduff@world.std.com (Robert A Duff)
Keywords: performance, assembler
Organization: The World Public Access UNIX, Brookline, MA
References: 95-11-166 95-11-197
Date: Tue, 28 Nov 1995 16:12:49 GMT

Stavros Macrakis <macrakis@osf.org> wrote:
>All this said, there is no guarantee than an assembly program will be
>faster than a compiled program.


My experience is that assembly language is often more efficient at
first, but after a few years of maintenance, it becomes less efficient.
I've seen cases where a large assembly language program was rewritten in
a high-level language, for portability, or ease of maintenance, and
everybody was surprised that in addition to those expected benefits, the
performance improved.


I suppose the performance of programs in any language would typically
tend to deteriorate during maintenance, unless one is very careful, but
it seems to me that with assembly language, it deteriorates faster. I
can think of two reasons:


First, if I modify a line of code in a procedure written in Ada or C or
whatever, the compiler will re-optimize that entire procedure. For
example, it will redo register allocation. In assembly, the original
coder might have done a better job of register allocation than a
compiler, but when a line of code is modified, the programmer is
unlikely to rewrite the entire procedure doing register allocation from
scratch -- to do so would risk introducing additional bugs.


Second, as new versions of the same machine come out, the relative
timing of various instructions may change, so various "clever tricks"
done for speed in the original assembly code might actually become
slower than alternative code sequences. With a high level language, it
is often feasible to recompile with a newer version of the compiler,
whereas with assembly, it is unlikely to be feasible to rewrite the
entire program.


- Bob
--


Post a followup to this message

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