Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Why are character arrays special (e
Message-ID: <1989Feb14.161906.16138@utzoo.uucp>
Organization: U of Toronto Zoology
References: <19742@uflorida.cis.ufl.EDU> <225800126@uxe.cso.uiuc.edu> <1989Feb10.191041.12109@utzoo.uucp> <1875@dataio.Data-IO.COM>
Date: Tue, 14 Feb 89 16:19:06 GMT

In article <1875@dataio.Data-IO.COM> bright@dataio.Data-IO.COM (Walter Bright) writes:
>The trouble with trigraphs is that they, along with the 'phases of
>translation' rules, require an extra test for each character of source...
>The reason this is a problem is because most of the time spent in a
>compiler is in the reading of source text and splitting it into tokens...

A compiler that spends most of its time tokenizing source obviously isn't
working very hard at code generation.  An optimizing compiler, or even a
non-pessimizing compiler, is not going to be tokenizing-bound, unless
there's been a remarkable leap of compiler technology while I wasn't
watching.  Also:

>...(yes, I use profilers).... I'm well aware of the rule that 90% of the
>execution time is spent in 10% of the code. This is true, however, of
>programs BEFORE profiling and fixing of that 10% occurs. Things flatten
>out a lot after that.

How thoroughly flattened is your compiler?

>... I've found in my compiler (Zortech) that ONE extra
>instruction executed per char read slows down the compiler by 5 to 10%.

Hmm, that's 10-20 instructions per character, with C typically about
20 chars/line, and with even a decidedly slow machine delivering an
instruction per microsecond, gives us 2500+ lines/second.  Is your
compiler really that fast?  I'm surprised.

>It's irritating to have to implement a feature that nobody in their right
>mind is going to use, and that has such a negative impact on the product...

If it's that big a deal, have you considered having a default "no trigraphs"
mode and a slower "trigraphs" mode?  That way, if nobody uses it, there's
no impact except for a bit of code that never gets executed.
-- 
The Earth is our mother;       |     Henry Spencer at U of Toronto Zoology
our nine months are up.        | uunet!attcan!utzoo!henry henry@zoo.toronto.edu
