[cfe-dev] PTH vs PCH usage

Vladimir Voskresensky vladimir.voskresensky at oracle.com
Mon Jan 9 15:39:38 PST 2012

Thanks. Will have a look.

On 01/09/2012 09:05 PM, Douglas Gregor wrote:
> On Jan 8, 2012, at 10:22 AM, Vladimir Voskresensky wrote:
>> Thanks for info.
>> Btw, any hints where to look in clang APIs/Impl for parts to be used for supporting fast incremental reparse/index-update in client which control editor/file changes?
> You can check out libclang's support for precompiled preambles, which implicitly create a precompiled header up to and including the last #include of the main source file. It's useful when reparsing that source file many times, e.g., during editing.
> 	- Doug
>> Thanks,
>> Vladimir.
>> On 01/01/2012 10:37 PM, Douglas Gregor wrote:
>>> On Dec 28, 2011, at 1:12 PM, Vladimir Voskresensky wrote:
>>>> Hello,
>>>> What kind of caching (i.e. for Indexing) should be used if Clang is to
>>>> be used from IDE-like applications for completion/x-ref features?
>>>> Does PCH is the right thing to use in such situations (at least I see it
>>>> mentioned in documentation for clang_createIndex)?
>>> PCH provides the best build-time and indexing-time improvements. I strongly recommend using it if you can, although it often requires that the user intervene by creating a prefix header that you can precompile.
>>>> What is the status of PTH? Is it live or deprecated?
>>> It's live. Performance gains from PTH are fairly limited… IIRC they were in the 10-20% range, which is far below what we tend to see with PCH.
>>>> Should it be used in interactive applications as cache mechanism as well?
>>> This idea has come up, although I don't know if anyone has tried it. Presumably, one could use PTH on all of the header files and then PCH for the prefix header, since the mechanisms compose.
>>> 	- Doug

More information about the cfe-dev mailing list