<div dir="ltr">Hi, <div><br></div><div>I have the same question over here.</div><div><br></div><div>Our test case cpp file of 1400 lines with a bunch of includes, resulting in 138 000 lines after preprocessing. <font face="courier new, monospace">parseTranslationUnit </font>takes <b>1.6 sec</b> for this translation unit with <font face="courier new, monospace">CXTranslationUnit_PrecompiledPreamble</font> flag only.</div>

<div><br></div><div>Afterward, on the same bench, the first call to <font face="courier new, monospace">reparseTranslationUnit </font>is even slower<b> (3 sec)</b>, but,</div><div>each of the following calls to <font face="courier new, monospace">reparseTranslationUnit </font>take only <b>0.4 sec</b>.</div>

<div><br></div><div>We were wondering why we can't tell which files have or haven't changed since the last reparse (can we ?). <br></div><div><br></div><div>The only app that I know of that seems to colorize after each keystroke is XCode. </div>

<div>I wonder if they use libclang or a lower level api, or an in-house solution, or a mix, and what are the optimizations that were required.<br></div><div><br></div><div>Does anyone know of an open source project that uses clang for syntax highlighting ( aside the abandonned project SourceCodeKit ) ?</div>

<div><br></div><div>Best Regards,</div><div>William</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 5, 2013 at 3:27 PM, Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;border:0px;padding:0px">


Hi.</p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;border:0px;padding:0px">
My tool (smth like IDE) uses Clang via C API. The main approach is the next, when the file is changed:</p><ol style="list-style-position:initial;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em 30px;border:0px;padding:0px">


<li style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">parseTranslationUnit</li><li style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">


getDiagnosticSetFromTU</li><li style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">tokenize</li><li style="margin:0px;padding:0px;border:0px;vertical-align:baseline;background-color:transparent">


indexSourceFile</li></ol><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;border:0px;padding:0px">


This makes all the features (highlighting, building file structure tree, diagnostics) working perfect, but it takes a lot of time as it's working on mobile device.</p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;border:0px;padding:0px">


I will do obvious optimization - executing in worker thread in order to avoid UI blocking, but i'd like to know about other optimizations.<br></p><p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;border:0px;padding:0px">


What can be done concurrently in order to get better performance (lower response time)? Is it safe to perform actions after parsing concurrently? Any other optimizations? Also i use a lot of libraries using '-I' arguments in commandLineArgs for parse() and index(). Is there any approach to avoid reparsing them each time user file is changed?</p>


<p style="clear:both;vertical-align:baseline;line-height:18px;font-size:14px;font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;margin:0px 0px 1em;border:0px;padding:0px">Regards, Anton.</p>
</div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>