Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I find out where the compiler spends its time?
    text
    copied!<p>How do I find out where the <strong>compiler</strong> spends its time?</p> <p>My build is too slow, I'm already using a RAMdisk for the VC++ temporary files and it doesn't make any difference. (I have an SSD, so I expected no difference.)</p> <p>Most single C++ files in this project take approx. 2 seconds to compile which seems awful (as I also don't have any in-project parallelization because I'm using VS2005).</p> <p>How can I optimize this? Don't optimize without profiling, but how do I profile the compiler?</p> <p>Note: These were not really helpful: </p> <ul> <li><a href="https://stackoverflow.com/questions/13559818/profiling-the-c-compilation-process">Profiling the C++ compilation process</a></li> <li><a href="https://stackoverflow.com/questions/82128/displaying-build-times-in-visual-studio">Displaying build times in Visual Studio?</a> (It isn't completely without merit though ... if you do a single-file compilation, instead of the whole project, it will show the time taken for a single file: That way I see that quite some files here take more that 5 seconds, some even 10 sec when compiled stand-alone)</li> </ul> <hr> <p>Let's add a good comment: <em>Do you have lot's of templates? How large are your files on average? Do you checked on including only the minimum of necessary headers</em></p> <p>No, I did not. I could (and pro'lly will) of course. I may be able to find something, but it's all <strong>speculation</strong> and <strong>trial and error</strong>!</p> <p>"Everybody" tells you that you should only optimize after measuring/profiling, but when optimizing compilation times, we're back to trial&amp;error?</p> <hr> <p>Note: The proposed "hack" from the comments with <code>__TIME__</code> does <em>not</em> work, at least not on Visual-C++, because (as <a href="http://msdn.microsoft.com/en-us/library/b0084kay%28v=vs.80%29.aspx" rel="nofollow noreferrer">the docs</a> state): <em>The <strong>most recent compilation time</strong> of the current source file. The time is a string literal of the form hh:mm:ss.</em> -- I guess one could at least get timings for single compilations units with this stamp, but it doesn't help to drill down into an compilation unit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload