This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: <iosfwd> also standard for std::string declaration?
- From: landrum Alfred <alfred137 at yahoo dot com>
- To: Nathan Myers <ncm-nospam at cantrip dot org>, libstdc++ at gcc dot gnu dot org
- Cc: alfred137 at yahoo dot com
- Date: Tue, 17 Jun 2003 15:32:04 -0700 (PDT)
- Subject: Re: <iosfwd> also standard for std::string declaration?
No, the 300ms is stable, that's from taking 4-5 runs.
I'd guess that's not coming about from disk io, its
that the compiler has to go through 350k more source:
$ g++ -E -o foo.i -DINCLUDE_STRING foo.cc
$ ls -l foo.i
-rw-rw-r-- 1 alfred alfred 366747 Jun 18
15:29 foo.i
$ g++ -E -o foo.i foo.cc
$ ls -l foo.i
-rw-rw-r-- 1 alfred alfred 122 Jun 18
15:29 foo.i
Thanks for the quick replies - I'll look into PCH,
since those would help out more than just the string
class.
-alfred
--- Nathan Myers <ncm-nospam@cantrip.org> wrote:
> The standard way is to include <string>. They
> elected not
> to split it up as in <iosfwd>, and <iosfwd> is not
> required
> to declare the string components.
>
> Does your 300ms describe the first time it is read,
> or is it the
> stable, repeatable time after it is already in the
> buffer cache?
> We care about compile time most when we have lots of
> modules to
> compiler, but string is read from disk typically
> only once.
>
> If you are serious about reducing compile times, you
> might like
> to investigate "precompiled headers" (PCH), which a
> search of
> the list archives will reveal more about.
>
> Nathan Myers
> ncm-nospam@cantrip.org
>
> On Tue, Jun 17, 2003 at 03:07:59PM -0700, landrum
> Alfred wrote:
> > Ok, I just did. On the Athlon 1800 I'm using, the
> > difference between including <string> & not is
> about
> > 300 milliseconds. Not that much, I admit. :)
> >
> > I started looking at this because I noticed how
> big of
> > a jump in size the .i's had before & after the
> > <string> inclusion - about 300k difference.
> >
> > Hmm. Well, just for completeness sake, is there a
> > standard way of getting a string declaration?
> >
> > --- Nathan Myers <ncm-nospam@cantrip.org> wrote:
> > > On Tue, Jun 17, 2003 at 02:23:15PM -0700,
> landrum
> > > Alfred wrote:
> > > > I'm trying to reduce my compile times. I have
> > > several
> > > > headers that are including <string>, even
> though
> > > they
> > > > only need a declaration.
> > > >
> > > > I noticed that <iosfwd> on my RH8 box includes
> > > > bits/stringfwd.h.
> > > >
> > > > Does this imply that including <iosfwd> is a
> > > standard
> > > > way to get a forward declaration of
> std::string?
> > >
> > >
> > > No, it's a non-standard way. BTW, have you
> measured
> > > a difference?
> > >
> > > Nathan Myers
> > > ncm-nospam@cantrip.org
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > SBC Yahoo! DSL - Now only $29.95 per month!
> > http://sbc.yahoo.com
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com