Why are character arrays special (e

Walter Bright bright at Data-IO.COM
Tue Feb 14 06:04:43 AEST 1989


In article <1989Feb10.191041.12109 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>I'm not
>in love with X3J11 trigraphs, but the issue isn't worth all the fuss that's
>been made about it.  At worst they are a minor and fairly benign mistake.)

The trouble with trigraphs is that they, along with the 'phases of
translation' rules, require an extra test for each character of source
read. A perfect scanner examines each source character exactly once, thus
we can measure the perfection of a scanner by on average how many times
each character is tested. A good scanner is about 1.1 on this scale.
Trigraphs push it over 2.0.

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.
(If this isn't so, then your symbol table implementation is botched or
something else is.) I've found in my compiler (Zortech) that ONE extra
instruction executed per char read slows down the compiler by 5 to 10%.

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.

So who cares about 10%? I do, a large percentage of my life is spent
waiting for compiles. My customers do too, it's a big issue for them.
Besides, 10% here, 10% there, 15% somewhere else, and it adds up to
a pig for a compiler. Programs are made fast by squeezing everywhere
possible (yes, I use profilers).

To digress for a moment, 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.



More information about the Comp.lang.c mailing list