[cfe-dev] Tips for optimising libclang
tobias at grosser.es
Tue Apr 2 11:51:22 PDT 2013
On 04/02/2013 08:47 PM, Miguel Guedes wrote:
> Hi Tobias,
> On Tue, 2013-04-02 at 19:45 +0200, Tobias Grosser wrote:
>> Three points:
>> When developing clang_complete, we noticed that
>> clang_parseTranslationUnit was not enough to initialize the
>> PrecompiledPreamble completely. Instead, we had to issue a reparse
>> between the initial parse and the codeComplete command. I never found
>> out if this was something we did wrong or something that libclang did
>> not get right.
> Strange. I'm seeing the exact same behaviour you describe. As you say,
> only after parsing and then reparsing do subsequent TU reparsing calls
> finish dramatically quicker. However, creating the preamble is now
> taking ~2500ms BUT subsequent updates take in the order of 250-260ms.
> Still a bit too high though.
This largely depends on the machine. On my (fast) laptop, the
clang_complete example file in examples/boost.cpp takes 0.046 seconds.
It would be really great to investigate this issue to get rid of the
need to reparse.
More information about the cfe-dev