Doug/Chandler, <div><br></div><div>I am seeing a following improvments. Without precompiled preamble, I get latencies of 2s to 3s.  But when it is enabled, I get latencies around ~1s.  Is this the best possible optimization available with libclang? </div>
<div><br></div><div>When I reparse translation unit without 'precompile preamble' enabled, I am seeing following latencies. I reparsed same source.cc five times: </div><div>#1. Reparsing source.cc:   0.7100 (100.0%)   0.0700 (100.0%)   0.7800 (100.0%)   2.6748 (100.0%)  </div>
<div>#2. Reparsing source.cc:   0.8000 (100.0%)   0.0300 (100.0%)   0.8300 (100.0%)   3.2166 (100.0%)  </div><div>#3. Reparsing source.cc:   0.7900 (100.0%)   0.0300 (100.0%)   0.8200 (100.0%)   2.4005 (100.0%)  </div><div>
#4. Reparsing source.cc:   0.7300 (100.0%)   0.0200 (100.0%)   0.7500 (100.0%)   2.1998 (100.0%) </div><div><div>#5. Reparsing source.cc:   0.7400 (100.0%)   0.0100 (100.0%)   0.7500 (100.0%)   2.2896 (100.0%)  </div><div>
<br></div><div><br></div><div>But when I enable precompile preamble, I do see some improvement in general. (from around ~2s earlier to ~1s now)</div><div>#1.</div><div>Precompiling preamble:   0.9200 (100.0%)   0.0200 (100.0%)   0.9400 (100.0%)   1.6569 (100.0%)  </div>
<div><div>Cache global code completions for /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   0.0600 (100.0%)   0.0600 (100.0%)   0.1440 (100.0%)  </div><div>Reparsing /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   1.0900 (100.0%)   0.0200 (100.0%)   1.1100 (100.0%)   2.5874 (100.0%)  </div>
</div><div><br></div><div>#2. Reparsing /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   0.1300 (100.0%)   0.0200 (100.0%)   0.1500 (100.0%)   3.5431 (100.0%)  </div><div>#3. Reparsing /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   0.1200 (100.0%)   0.0200 (100.0%)   0.1400 (100.0%)   1.0338 (100.0%) </div>
<div>#4. Reparsing /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   0.1400 (100.0%)   0.1400 (100.0%)   1.0945 (100.0%) </div><div>#5. Reparsing /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   0.1000 (100.0%)   0.0300 (100.0%)   0.1300 (100.0%)   0.9824 (100.0%)  </div>
<div>#6. Reparsing /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   0.1300 (100.0%)   0.0100 (100.0%)   0.1400 (100.0%)   1.1601 (100.0%) </div><div>[Note: There is no precompiling happening if no headers are changed as expected.]</div>
<div><br></div><div>And when I modified one of its header file, I see precompiling preamble again : </div><div>#7. Precompiling preamble:   0.9000 (100.0%)   0.0500 (100.0%)   0.9500 (100.0%)   2.1090 (100.0%)</div><div><div>
Reparsing /tmp/cider/abhanshu/63/google3/bigtable/aggregate/aggregate_client.cc:   1.0300 (100.0%)   0.0700 (100.0%)   1.1000 (100.0%)   3.5036 (100.0%)  </div></div><div><br></div><div><br></div><div><br></div><div><br></div>
<div class="gmail_quote">On Wed, Apr 4, 2012 at 2:41 PM, Abhanshu Sharma <span dir="ltr"><<a href="mailto:abhanshu1@gmail.com">abhanshu1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><br><div class="gmail_quote"><div><div class="h5">On Wed, Apr 4, 2012 at 2:38 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="gmail_quote">On Wed, Apr 4, 2012 at 11:01 AM, Abhanshu Sharma <span dir="ltr"><<a href="mailto:abhanshu1@gmail.com" target="_blank">abhanshu1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


I am trying to reduce every fraction of second possible. Since there are very large of header files, I guess there would be some time getting wasted in stat-ing those files. I want clang to assume everything else is constant except source file. </blockquote>


</div><br></div><div>Stating is *extremely* fast, and does not have any bearing on the size of the header file.</div><div><br></div><div>Let me emphasize: *extremely* fast. 'git status' stats every single file in the entire git tree in a tiny fraction of a second.</div>


<div><br></div><div>Do you have a benchmark that clearly shows how much time is spent on 'stat' here? Are you using a network filesystem that makes stat system calls slow for some reason?</div></blockquote></div>
</div><div>Yes I am using FUSE filesystems. I am not sure how slow stats are in my case. I can check that. But it looks like I have already stretched clang for my use to its maximum. </div><span class="HOEnZb"><font color="#888888">
</font></span></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Warm Regards,<br>Abhanshu<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Warm Regards,<br>Abhanshu<br>
</div>