query of gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux