[cfe-dev] Clang tool optimizations for performance?

Anton Smirnov dev at antonsmirnov.name
Thu Dec 5 06:27:10 PST 2013


My tool (smth like IDE) uses Clang via C API. The main approach is the
next, when the file is changed:

   1. parseTranslationUnit
   2. getDiagnosticSetFromTU
   3. tokenize
   4. indexSourceFile

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.

I will do obvious optimization - executing in worker thread in order to
avoid UI blocking, but i'd like to know about other optimizations.

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?

Regards, Anton.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131205/86aa5647/attachment.html>

More information about the cfe-dev mailing list