Re: Folk Theorem: Assemblers are superior to Compilers

mps@dent.uchicago.edu (Michael Spertus)
Thu, 28 Oct 1993 14:51:04 GMT

          From comp.compilers

Related articles
[7 earlier articles]
Re: Folk Theorem: Assemblers are superior to Compilers macrakis@osf.org (1993-10-27)
Re: Folk Theorem: Assemblers are superior to Compilers amn@ubik.demon.co.uk (1993-10-27)
Re: Folk Theorem: Assemblers are superior to Compilers synaptx!thymus!daveg@uunet.UU.NET (Dave Gillespie) (1993-10-27)
Re: Folk Theorem: Assemblers are superior to Compilers winikoff@munta.cs.mu.OZ.AU (1993-10-28)
Re: Folk Theorem: Assemblers are superior to Compilers prener@watson.ibm.com (1993-10-28)
Folk Theorem: Assemblers are superior to Compilers Mark_Prince@gec-epl.co.uk (1993-10-28)
Re: Folk Theorem: Assemblers are superior to Compilers mps@dent.uchicago.edu (1993-10-28)
Re: Folk Theorem: Assemblers are superior to Compilers toon@moene.indiv.nluug.nl (1993-10-28)
Re: Folk Theorem: Assemblers are superior to Compilers raymondc@microsoft.com (1993-10-28)
Re: Folk Theorem: Assemblers are superior to Compilers adk@sun13.SCRI.FSU.EDU (1993-10-29)
Re: Folk Theorem: Assemblers are superior to Compilers elliottm@csulb.edu (1993-10-29)
Re: Folk Theorem: Assemblers are superior to Compilers jvn@fermi.clas.virginia.edu (Julian V. Noble) (1993-10-29)
Re: Folk Theorem: Assemblers are superior to Compilers Freek.Wiedijk@phil.ruu.nl (1993-10-29)
[14 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: mps@dent.uchicago.edu (Michael Spertus)
Keywords: assembler, optimize, performance
Organization: University of Chicago -- Academic & Public Computing
References: 93-10-114 93-10-123
Date: Thu, 28 Oct 1993 14:51:04 GMT

I write most of my programs in high level languages. Usually C++. My
definition of high level is whatever states the problem best. Where
performance is important I use a profiler to discover where the program or
class is spending its time. Then I may recode the hot spots in assembler
often starting from the code generated by the compiler.


Generally this produces a small but useful improvement but there are
stunning exceptions. The best is multiple precision arithmetic functions.
C does not let you get at the carry flag or the overflow flag. This makes
writing multi precision arithmetic in C harder than doing the same job in
assembler. The best way (on 80x86s) is to do it a byte at a time and look
at the top of a word. In assembler everything is a word at a time and much
more readable and direct. The result is about 5 times faster.


There are stories like this for every language (with the possible
exception of Cobol) some problem so well suited to the language that
everything else looks stupid. By the way I did not spend time worrying
about pipelining or getting every last cycle down. I tried to write the
most direct and readable code. It was more direct and readable in
assembler than in any other language but Icon where it would be too slow.
--


Post a followup to this message

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