I'm reporting this because I haven't seen it noted elsewhere and think
it would be good to have a record of it.
I ran a simple test, 10000 x #include <sys/types.h>, preprocess only:
pcc 21.08s real 20.73s user 0.25s system
bsd 1.93s real 1.71s user 0.20s system
gcc 0.05s real 0.03s user 0.02s system
bsd is the preprocessor from MirOS src/libexec/cpp, apparently from 4.4BSD.
Looking at gcc/pcc with ktrace/truss, gcc does not seem to be
doing anything particularly special. It appears to be re-parsing
the files, but I haven't looked at its source. So it's I/O pattern looks
much like pcc.
I don't think it is related to I/O methods, memory allocation or nults-and-bolt
stuff like symbol lookup. It seems to be the lex/yacc parser.
It's unfortunate because the preprocessor is eating up a lot of the
efficiency that the compiler itself displays.
I have attached gprof output. It's from a short 20 second run but
does give some indication of what goes on.
I don't have time to look at this in depth (I wish I did).