3

I have this big C++ boostified project that takes ages to build so i'm trying to set up compilation firewalls. Now I could sprinkle pimpls or pure interfaces following my intuition but that doesn't seem very efficient... usually if i wanted to optimize a piece of code, I would run it through a profiler to see the bottlenecks which leads me to the following question: how do I see where are the bottlenecks in my compilation time?

All answers including trying alternate compilers are welcomed since code is cross-platform (crosses fingers!)

Thanks,

Gurg Hackpof
  • 1,304
  • 1
  • 13
  • 26
  • Possible duplicate of http://stackoverflow.com/questions/2542273/c-g-llvm-clang-compiler-profiling, http://stackoverflow.com/questions/13559818/profiling-the-c-compilation-process – Arne Mertz Apr 08 '13 at 07:34
  • What have you tried? Most compilers I've worked without can output timing data. – Peter Wood Apr 08 '13 at 07:35
  • @ArneMertz Unless I missed something, both of your threads are quite coarse: they basically tell you the problem lies with parsing / templating but not exactly where (aka which classes) are an issue – Gurg Hackpof Apr 08 '13 at 07:56
  • @PeterWood Same kind of answer than Arne: I know that gcc has an option that basically shows that all the time is spent in the templates and that's it. Doesn't tell me which templates though. What are you refering to exactly? – Gurg Hackpof Apr 08 '13 at 07:57
  • @GurgHackpof no, the answers to those questions tell you about how you get the best profiling possible out of the compilers. The answer to your question can be found there: there's only a very broad profiling, not telling you exactly what the bottlenecks are, but giving you at least some hints. – Arne Mertz Apr 08 '13 at 08:02
  • I've written a script which goes through each header, and compiles it into an executable. This makes sure each header is self contained. It would be pretty simple to time it and work out what is taking longer. – Peter Wood Apr 08 '13 at 08:03
  • @PeterWood, that sounds like an interesting strategy. Would you care sharing your base script? – Gurg Hackpof Apr 08 '13 at 09:03
  • I wrote the script over a couple of hours, on company time, so I'm afraid I can't share it with you. It's part of our continuous integration scripts. It shouldn't be too hard to do yourself. If you can build your system from the command line already, you're most of the way there. It might not take you as long, I'm a very slow coder. – Peter Wood Apr 08 '13 at 12:34

0 Answers0