This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: first pass of wrapup_global_declarations performance improvements
Mark Mitchell <mark@codesourcery.com> writes:
> --On Friday, February 14, 2003 01:08:22 PM -0800 Matt Austern
> <austern@apple.com> wrote:
>
> > This patch does two things.
> >
> > First, it changes an unconditional write into a conditional write. This
> > is because, empirically, the unconditional write dirties pages
> > unnecessarily. This is a noticeable performance problem, especially when
> > using PCH.
>
> This is OK, thanks.
>
> You should probably also add a note to the coding standards page
> (wherever that is; I've forgotten) to advocate using a conditional in
> situations like that, if we really think that's likely to be a win in
> many places. Or else a comment in this one, indicating that.
>
> (It occurs to me that this is actually a job for profile-directed
> feedback; if I'm setting these bits to the same value they already
> have 99% of the time, it's probably a good idea to insert an
> additional read, and leave out the write.)
Really, every place that something like this can happen, we already
have a problem. It's OK to write to data structures that are in some
fashion related to the source code (so, if you see a second
declaration of something, writing to its decl is fine), the problem is
that this code goes through *every* decl (which is already a problem)
and writes to it.
The hope is that eventually a large precompiled header won't need to
be fully read into memory to compile a short program that doesn't use
most of the declarations in the header; there's a lot of work to do
before that can happen, but at least we can avoid _writing_ to each
page of the header so that the OS can cache it.
--
- Geoffrey Keating <geoffk@geoffk.org>