<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 18, 2015, at 9:36 AM, Manuel Klimek <<a href="mailto:klimek@google.com" class="">klimek@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Wed, Nov 18, 2015 at 6:19 PM Douglas Gregor <<a href="mailto:dgregor@apple.com" class="">dgregor@apple.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class=""><br class=""><br class="">Sent from my iPhone</div></div><div dir="auto" class=""><div class=""><br class="">On Nov 18, 2015, at 8:19 AM, Manuel Klimek <<a href="mailto:klimek@google.com" target="_blank" class="">klimek@google.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class="">(now with the right list)</div><div class=""><br class=""></div><div dir="ltr" class="">On Tue, Nov 16, 2010 at 12:03 AM Douglas Gregor <<a href="mailto:dgregor@apple.com" target="_blank" class="">dgregor@apple.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dgregor<br class="">
Date: Mon Nov 15 17:00:34 2010<br class="">
New Revision: 119285<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=119285&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=119285&view=rev</a><br class="">
Log:<br class="">
Tweak libclang's heuristics for building precompiled preambles and<br class="">
caching global code-completion results. In particular, don't perform<br class="">
either operation the first time we parse, but do both after the first<br class="">
reparse.<br class=""></blockquote><div class=""><br class=""></div><div style="font-size:13px;line-height:19.5px" class="">Do you remember the reason behind not building the preamble on the first parse? For really large TUs having to parse 2 times before we get a preamble is rather painful.</div></div></div></div></blockquote><div class=""><br class=""></div></div><div dir="auto" class="">We wanted to get the first set of results quickly, especially for syntax coloring when a file is first opened. </div></blockquote><div class=""><br class=""></div><div class="">Do you remember how much storing the preamble would make this slower (without the preamble many of our parses are >> 20 seconds, so 2x that is rather unfortunate). Perhaps we can add a flag?</div></div></div></div></blockquote><div><br class=""></div><div>I don’t remember the numbers from… 5 years ago. I do remember that it was a noticeable lag in the UI when opening a new file, primarily because the AST serialization step needed to produce the preamble file is fairly expensive. You can turn on the timers by setting the LIBCLANG_TIMING environment variable to see how long things are taking without having to recompile, since it’s probably worth re-measuring now.</div><div><br class=""></div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class=""><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div style="font-size:13px;line-height:19.5px" class=""><br class=""></div><div style="font-size:13px;line-height:19.5px" class="">Cheers,</div><div class=""><span style="font-size:13px;line-height:19.5px" class="">/Manuel</span> </div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="">
Modified:<br class="">
    cfe/trunk/lib/Frontend/ASTUnit.cpp<br class="">
    cfe/trunk/tools/c-index-test/c-index-test.c<br class="">
<br class="">
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=119285&r1=119284&r2=119285&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)<br class="">
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Nov 15 17:00:34 2010<br class="">
@@ -326,7 +326,6 @@<br class="">
<br class="">
   // Make a note of the state when we performed this caching.<br class="">
   NumTopLevelDeclsAtLastCompletionCache = top_level_size();<br class="">
-  CacheCodeCompletionCoolDown = 15;<br class="">
 }<br class="">
<br class="">
 void ASTUnit::ClearCachedCompletionResults() {<br class="">
@@ -824,12 +823,6 @@<br class="">
   }<br class="">
<br class="">
   Invocation.reset(Clang.takeInvocation());<br class="">
-<br class="">
-  // If we were asked to cache code-completion results and don't have any<br class="">
-  // results yet, do so now.<br class="">
-  if (ShouldCacheCodeCompletionResults && CachedCompletionResults.empty())<br class="">
-    CacheCodeCompletionResults();<br class="">
-<br class="">
   return false;<br class="">
<br class="">
 error:<br class="">
@@ -1350,7 +1343,7 @@<br class="">
<br class="">
   llvm::MemoryBuffer *OverrideMainBuffer = 0;<br class="">
   if (PrecompilePreamble) {<br class="">
-    PreambleRebuildCounter = 1;<br class="">
+    PreambleRebuildCounter = 2;<br class="">
     OverrideMainBuffer<br class="">
       = getMainBufferWithPrecompiledPreamble(*Invocation);<br class="">
   }<br class="">
@@ -1377,6 +1370,7 @@<br class="">
   AST->CaptureDiagnostics = CaptureDiagnostics;<br class="">
   AST->CompleteTranslationUnit = CompleteTranslationUnit;<br class="">
   AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;<br class="">
+  AST->CacheCodeCompletionCoolDown = 1;<br class="">
   AST->Invocation.reset(CI);<br class="">
<br class="">
   return AST->LoadFromCompilerInvocation(PrecompilePreamble)? 0 : AST.take();<br class="">
@@ -1481,6 +1475,7 @@<br class="">
   AST->CaptureDiagnostics = CaptureDiagnostics;<br class="">
   AST->CompleteTranslationUnit = CompleteTranslationUnit;<br class="">
   AST->ShouldCacheCodeCompletionResults = CacheCodeCompletionResults;<br class="">
+  AST->CacheCodeCompletionCoolDown = 1;<br class="">
   AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();<br class="">
   AST->NumStoredDiagnosticsInPreamble = StoredDiagnostics.size();<br class="">
   AST->StoredDiagnostics.swap(StoredDiagnostics);<br class="">
<br class="">
Modified: cfe/trunk/tools/c-index-test/c-index-test.c<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=119285&r1=119284&r2=119285&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/c-index-test.c?rev=119285&r1=119284&r2=119285&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/tools/c-index-test/c-index-test.c (original)<br class="">
+++ cfe/trunk/tools/c-index-test/c-index-test.c Mon Nov 15 17:00:34 2010<br class="">
@@ -1040,6 +1040,11 @@<br class="">
     fprintf(stderr, "Unable to load translation unit!\n");<br class="">
     return 1;<br class="">
   }<br class="">
+<br class="">
+  if (clang_reparseTranslationUnit(TU, 0, 0, clang_defaultReparseOptions(TU))) {<br class="">
+    fprintf(stderr, "Unable to reparse translation init!\n");<br class="">
+    return 1;<br class="">
+  }<br class="">
<br class="">
   for (I = 0; I != Repeats; ++I) {<br class="">
     results = clang_codeCompleteAt(TU, filename, line, column,<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
cfe-commits mailing list<br class="">
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank" class="">cfe-commits@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br class="">
</blockquote></div></div>
</div></blockquote></div></div></blockquote></div></div>
</div></blockquote></div><br class=""></body></html>