Path: utzoo!mnetor!uunet!husc6!hao!ames!necntc!ima!johnl
From: rcd@ico.isc.COM
Newsgroups: comp.compilers
Subject: Re: Compilers producing assembly language
Message-ID: <782@ima.ISC.COM>
Date: 10 Dec 87 05:32:31 GMT
References: <765@ima.UUCP> <26100001@nixpbe.UUCP>
Sender: johnl@ima.ISC.COM
Reply-To: rcd@ico.isc.COM
Organization: Interactive Systems Corp, Boulder, CO
Lines: 33
Summary: questionable generalization about lex time
Approved: compilers@ima.UUCP

In article <26100001@nixpbe.UUCP>, gla@nixpbe.UUCP writes:
...
> First, it is a performance reason.
> Lexical analysis takes about 30% of time in any compile/assembly
> program. This can be saved if the assembly step is integrated.

This is a rather rash generalization--the numbers probably run from 5% to
over 60% of time.

It is also a weak argument against the compiler generating assembly language.
If you're spending that much time lexing, either you've got a very fast
compiler system (in which case it doesn't matter much) or you've done an
abominable job on the lexer (in which case you can rework the lexer).
Bear in mind that the lexer of concern is the one for the assembler, not
the one for the compiler proper--and lexing assembly language <> to
be easy (thus amenable to simple tuning).

[This is not to say that it doesn't happen.  I recall the early ETH Pascal
compilers spending something over 50% of their time in source input and lex
analysis.  It was a combination of careless lexical analysis, a mediocre
text I/O system, and a very fast rest-of-the-compiler with trivial work in
the code generation.]
[I've heard that an astounding fraction of PCC's time is usually spent in
the printf() calls to write out the assembler code.  -John]
-- 
Dick Dunn      UUCP: {hao,nbires,cbosgd}!ico!rcd       (303)449-2870
   ...CAUTION:  I get mean when my blood-capsaicin level gets low.

--
Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.ARPA
Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbn}!ima
Please send responses to the originator of the message -- I cannot forward
mail accidentally sent back to compilers.  Meta-mail to ima!compilers-request