Re: [scheme-reports-wg2] Threads and futures
Ray Dillinger 02 Apr 2022 00:00 UTC
On 4/1/22 23:49, Per Bothner wrote:
> A "correctly-written" header file has the format:
>
> /* comments and whitespace */
> #ifndef GUARD
> BODY
> #endif
> /*trailing comments and whitespace */
>
> The first time you read the file, it is easy to verify that it matches
> this format, and if so stash (EXPANDED_FILENAME, GUARD) in a hash table
> On subsequent encounters of #include EXPANDED_FILENAME it is easy to
> check GUARD: if it is defined, no need to open the file.
Okay, I agree with you... it ought to be easy ... I can't think of a
specific reason why it shouldn't be ... but take a large project that
has libraries included from lots of different directions and by lots of
different paths, and instrument the compiler. See whether it's spending
90% of its time parsing header files. And you'll see that this
optimization is not happening. I assume there's some esoteric
language-standard reason why not.
Bear