[PATCH] D54547: PTH-- Remove feature entirely-

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 16 10:54:05 PST 2018


erichkeane added a comment.

In https://reviews.llvm.org/D54547#1301351, @voskresensky.vladimir wrote:

> I have some experience with PTH implementation, because had to fix it for Java-port of Clang (https://github.com/java-port/clank).
>
> It was sometime ago, but making it completely workable was not hard.
>  As I remember the key fix was just to have PTH be EMITTED using raw-Lex mode (where real keyword-IDs are not used, so all Token Kinds nicely fit 8-bits).
>  It worked, because on token automatically became keyword by PTHLexer::Lex:
>  ...
>
>      // Change the kind of this identifier to the appropriate token kind, e.g.
>      // turning "for" into a keyword.
>   Tok.setKind(II->getTokenID());
>
> ...
>
> We used PTH, because multiple translation units are parsed in the context of single run.
>  In this case preprocessing phase was upto 10x faster when token stream was deserialized from PTH (i.e. for all system headers lexed once).
>  Also it was helpful, because we were able to parse from concurrent threads using the same shared immutable mmaped PTH.
>
> I thought clang-d service is using it to speed up indexing.


Presumably, I could also just make PTH use another bit or two for the TokenID and it would work fine.  However, when I mentioned this on IRC the general response was that it is a 'failed experiment'.  In your use case, I wonder why you couldn't just use PCH and get even further performance improvements?


https://reviews.llvm.org/D54547





More information about the cfe-commits mailing list