public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* query of gcc
@ 2004-12-23  5:02 Deepak Soi
  2004-12-23 12:56 ` Eljay Love-Jensen
  2004-12-23 21:50 ` Ken Foskey
  0 siblings, 2 replies; 3+ messages in thread
From: Deepak Soi @ 2004-12-23  5:02 UTC (permalink / raw)
  To: gcc-help

Hi,
    I have a query regarding the use of gnu compiler gcc . When i 
compile 50  files of a project (.cpp and .c ) using makefile utility 
sequentially , it will take around 75 secs, as noted by "time" command. 
But when i make a single compilation unit of all, it takes just 3 secs 
to compile.By single compilation unit , i mean i create another file 
my.cpp and I  #include all the .cpp files into it. then the compilation 
is showing this much reduction in our project's case.
Surely this difference is due to the time involved due to loading of 
same header files again and again when it is #included in more than 1 
.cpp file So in latter case, each header file will be loaded once, but 
in former case, it will be loaded(ofcourse compiled also) again and 
again for each .cpp file, hence causing the time problem.
                                                       So my question is 
, Can we set some option in the gcc for a particular project, so that if 
once that header has been loaded or its path has been searched, its path 
been stored somewhere(hashtable of paths) so that  it can used for other 
files of the project and reduce loading(no compiling time) time ,hence 
reducing the overall compile time or rather can we maintain a cache of 
all the header filles so that again reloading is not required. I know 
about pre-compiling the headers, but anything else than that which is 
possible,will be great????
                          
What I feel  is ,I can't use precompiled headers in my project, as i 
have a number of modules in our whole project, and each module has 
different header requirements. However with in a module , the headers 
required by all .cpp files are almost same.So in this case, I can't set 
aside few headers to be pre-compiled for whole project. Also, second 
thing is i don't know about the which header files will be reqd. by each 
module in advance , without scanning the whole project, so i can't 
choose which headers to precompile.
                                                                       
                   Whereas if we can cache the header-file  which is 
once loaded in to memory, then later if its reqd, we won't load it 
again, during the compilation of next .cpp file, it can be of help- in 
saving the compilation time of the next .cpp file. What you suggest? Can 
it be an additional functionality? Do we have something to support it 
right now in gcc ?

regards
Deepak Soi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: query of gcc
  2004-12-23  5:02 query of gcc Deepak Soi
@ 2004-12-23 12:56 ` Eljay Love-Jensen
  2004-12-23 21:50 ` Ken Foskey
  1 sibling, 0 replies; 3+ messages in thread
From: Eljay Love-Jensen @ 2004-12-23 12:56 UTC (permalink / raw)
  To: sdeepak, gcc-help

Hi Deepak Soi,

 >What you suggest?

I suggest you read this book:
Large-Scale C++ Software Design
by John Lakos
Addison-Wesley Professional Computing Series
ISBN 0-201-63362-0

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: query of gcc
  2004-12-23  5:02 query of gcc Deepak Soi
  2004-12-23 12:56 ` Eljay Love-Jensen
@ 2004-12-23 21:50 ` Ken Foskey
  1 sibling, 0 replies; 3+ messages in thread
From: Ken Foskey @ 2004-12-23 21:50 UTC (permalink / raw)
  To: gcc help

On Thu, 2004-12-23 at 10:06 +0530, Deepak Soi wrote:
> compile 50  files of a project (.cpp and .c ) using makefile utility 
> sequentially , it will take around 75 secs, as noted by "time" command.

So...  You should not be changing all 75 files or common headers to
force this very much.  My compile times from end to end are 4 hours best
case, 19 hours worst case.   I can rebuild in about 30 seconds normally
just checking the dependencies.

You are optimising the wrong problem.

> Surely this difference is due to the time involved due to loading of 
> same header files again and again when it is #included in more than 1 

look up ccache.  This takes down my compile times from 19 hours to 4
hours, huge difference.

-- 
Ken Foskey
OpenOffice.org developer


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-23 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-23  5:02 query of gcc Deepak Soi
2004-12-23 12:56 ` Eljay Love-Jensen
2004-12-23 21:50 ` Ken Foskey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).