llvm-project/clang/test
Ted Kremenek 52f73cad4a Fix: <rdar://problem/6510344> [pth] PTH slows down regular lexer considerably (when it has substantial work)
Changes to IdentifierTable:
- High-level summary: StringMap never owns IdentifierInfos.  It just
references them.
- The string map now has StringMapEntry<IdentifierInfo*> instead of
  StringMapEntry<IdentifierInfo>.  The IdentifierInfo object is
  allocated using the same bump pointer allocator as used by the
  StringMap.

Changes to IdentifierInfo:
- Added an extra pointer to point to the
  StringMapEntry<IdentifierInfo*> in the string map.  This pointer
  will be null if the IdentifierInfo* is *only* used by the PTHLexer
  (that is it isn't in the StringMap).

Algorithmic changes:
- Non-PTH case:
   IdentifierInfo::get() will always consult the StringMap first to
   see if we have an IdentifierInfo object.  If that StringMapEntry
   references a null pointer, we allocate a new one from the BumpPtrAllocator
   and update the reference in the StringMapEntry.
- PTH case:
   We do the same lookup as with the non-PTH case, but if we don't get
   a hit in the StringMap we do a secondary lookup in the PTHManager for
   the IdentifierInfo.  If we don't find an IdentifierInfo we create a
   new one as in the non-PTH case.  If we do find and IdentifierInfo
   in the PTHManager, we update the StringMapEntry to refer to it so
   that the IdentifierInfo will be found on the next StringMap lookup.
   This way we only do a binary search in the PTH file at most once
   for a given IdentifierInfo.  This greatly speeds things up for source
   files containing a non-trivial amount of code.

Performance impact:
   While these changes do add some extra indirection in
   IdentifierTable to access an IdentifierInfo*, I saw speedups even
   in the non-PTH case as well.

   Non-PTH: For -fsyntax-only on Cocoa.h, we see a 6% speedup.
   PTH (with Cocoa.h in token cache): 11% speedup.

   I also did an experiment where we did -fsyntax-only on a source file
   including a large header and Cocoa.h, but the token cache did not
   contain the larger header.  For this file, we were seeing a performance
   *regression* when using PTH of 3% over non-PTH.  Now we are seeing
   a performance improvement of 9%!

Tests:
   The serialization tests are now failing.  I looked at this extensively,
   and I my belief is that this change is unmasking a bug rather than
   introducing a new one.  I have disabled the serialization tests for now.

llvm-svn: 62636
2009-01-20 23:28:34 +00:00
..
Analysis Add -analyze action to run static analyzer, instead of inferring from 2009-01-20 23:17:32 +00:00
CodeGen Vector codegen improvements 2009-01-18 06:42:49 +00:00
CodeGenCXX make ScalarExprEmitter::EmitCompare() emit the expression with the correct type instead of always zext it to an int 2009-01-11 23:22:37 +00:00
CodeGenObjC Detailed documentation for encoding of properties and a test 2009-01-20 20:04:12 +00:00
Coverage A couple more vector component access fixes. 2009-01-18 02:01:21 +00:00
Driver Change -verify mode to find the "expected-error" and "expected-warning" strings 2008-11-21 01:18:36 +00:00
Lexer Fix PR2477 - clang misparses "//*" in C89 mode 2009-01-16 22:39:25 +00:00
Misc fix bogus run line. 2008-08-18 19:54:48 +00:00
Parser Centralize error reporting of improper uses of incomplete types in the 2009-01-19 19:26:10 +00:00
Preprocessor fix rdar://6505352 - Bogus warning with -WUndef, a case 2009-01-18 21:18:58 +00:00
Rewriter Fix <rdar://problem/6465284> clang ObjC rewriter: objc_super messed up again. 2008-12-23 20:11:22 +00:00
Sema Improvements to Sema of asm statements. Fixes <rdar://problem/6156893> 2009-01-20 20:49:22 +00:00
SemaCXX Add missing test case for operator ! result type. 2009-01-19 21:37:51 +00:00
SemaObjC Type of property and its ivar is more restrictive 2009-01-19 20:13:47 +00:00
SemaObjCXX Use a single function for doing vararg argument promotion. Also, make sure to do the promotion before checking the type - fixes PR3340. 2009-01-16 16:48:51 +00:00
Serialization Fix: <rdar://problem/6510344> [pth] PTH slows down regular lexer considerably (when it has substantial work) 2009-01-20 23:28:34 +00:00
Makefile Add test case for __ASSEMBLER__ definition. 2008-12-01 19:23:47 +00:00
TestRunner.sh Test commit. 2008-10-15 00:26:06 +00:00