From: Douglas Gregor Date: Fri, 11 Feb 2011 00:52:17 +0000 (+0000) Subject: Eliminate a major performance problem with chained PCH, where we were X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=217cacc7f8542a3b87309f30ecfed69cbc4afe04;p=clang Eliminate a major performance problem with chained PCH, where we were causing the deserialization of a large number of declarations when writing the visible-updates record for the translation unit in C. This takes us from: *** AST File Statistics: 2 stat cache hits 6 stat cache misses 1/64463 source location entries read (0.001551%) 15606/16956 types read (92.038216%) 59266/89334 declarations read (66.342041%) 38952/61393 identifiers read (63.446976%) 0/7778 selectors read (0.000000%) 24192/34644 statements read (69.830276%) 388/8809 macros read (4.404586%) 2095/5189 lexical declcontexts read (40.373867%) 0/4587 visible declcontexts read (0.000000%) 0/7716 method pool entries read (0.000000%) 0 method pool misses to *** AST File Statistics: 2 stat cache hits 6 stat cache misses 1/64463 source location entries read (0.001551%) 26/16956 types read (0.153338%) 18/89334 declarations read (0.020149%) 145/61393 identifiers read (0.236183%) 0/7778 selectors read (0.000000%) 21/34644 statements read (0.060617%) 0/8809 macros read (0.000000%) 0/5189 lexical declcontexts read (0.000000%) 0/4587 visible declcontexts read (0.000000%) 0/7716 method pool entries read (0.000000%) 0 method pool misses when generating a chained PCH for a header that #includes Cocoa.h (from a PCH file) and adds one simple function declaration. The generated PCH file is now only 9580 bytes (down from > 2MB). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125326 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index ce68649142..f1af8354a2 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -2475,10 +2475,6 @@ uint64_t ASTWriter::WriteDeclContextVisibleBlock(ASTContext &Context, /// DeclContext in a dependent AST file. As such, they only exist for the TU /// (in C++) and for namespaces. void ASTWriter::WriteDeclContextVisibleUpdate(const DeclContext *DC) { - // Make the context build its lookup table, but don't make it load external - // decls. - DC->lookup(DeclarationName()); - StoredDeclsMap *Map = static_cast(DC->getLookupPtr()); if (!Map || Map->empty()) return;