Skip to content
  1. Jan 18, 2009
  2. Jan 17, 2009
  3. Jan 16, 2009
  4. Jan 15, 2009
    • Ted Kremenek's avatar
      PTH: Fix termination condition in binary search. · 4bbb79a6
      Ted Kremenek authored
      llvm-svn: 62277
      4bbb79a6
    • Ted Kremenek's avatar
      IdentifierInfo: · a705b04d
      Ted Kremenek authored
      - IdentifierInfo can now (optionally) have its string data not be
        co-located with itself.  This is for use with PTH.  This aspect is a
        little gross, as getName() and getLength() now make assumptions
        about a possible alternate representation of IdentifierInfo.
        Perhaps we should make IdentifierInfo have virtual methods?
      
      IdentifierTable:
      - Added class "IdentifierInfoLookup" that can be used by
        IdentifierTable to perform "string -> IdentifierInfo" lookups using
        an auxilliary data structure.  This is used by PTH.
      - Perform tests show that IdentifierTable::get() does not slow down
        because of the extra check for the IdentiferInfoLookup object (the
        regular StringMap lookup does enough work to mitigate the impact of
        an extra null pointer check).
      - The upshot is that now that some IdentifierInfo objects might be
        owned by the IdentiferInfoLookup object.  This should be reviewed.
      
      PTH:
      - Modified PTHManager::GetIdentifierInfo to *not* insert entries in
        IdentifierTable's string map, and instead create IdentifierInfo
        objects on the fly when mapping from persistent IDs to
        IdentifierInfos.  This saves a ton of work with string copies,
        hashing, and StringMap lookup and resizing.  This change was
        motivated because when processing source files in the PTH cache we
        don't need to do any string -> IdentifierInfo lookups.
      - PTHManager now subclasses IdentifierInfoLookup, allowing clients of
        IdentifierTable to transparently use IdentifierInfo objects managed
        by the PTH file.  PTHManager resolves "string -> IdentifierInfo"
        queries by doing a binary search over a sorted table of identifier
        strings in the PTH file (the exact algorithm we use can be changed
        as needed).
      
      These changes lead to the following performance changes when using PTH on Cocoa.h:
      - fsyntax-only: 10% performance improvement
      - Eonly: 30% performance improvement
      
      llvm-svn: 62273
      a705b04d
    • Ted Kremenek's avatar
      PTH: Embed a persistentID side-table in the PTH file that is sorted in the · bef9fc22
      Ted Kremenek authored
      lexical order of the corresponding identifier strings. This will be used for a
      forthcoming optimization. This slows down PTH generation time by 7%. We can
      revert this change if the optimization proves to not be valuable.
      
      llvm-svn: 62248
      bef9fc22
  5. Jan 14, 2009
    • Ted Kremenek's avatar
      PTH: · e9814186
      Ted Kremenek authored
      - Use canonical FileID when using getSpelling() caching.  This
        addresses some cache misses we were seeing with -fsyntax-only on
        Cocoa.h
      - Added Preprocessor::getPhysicalCharacterAt() utility method for
        clients to grab the first character at a specified sourcelocation.
        This uses the PTH spelling cache.
      - Modified Sema::ActOnNumericConstant() to use
        Preprocessor::getPhysicalCharacterAt() instead of
        SourceManager::getCharacterData() (to get PTH hits).
      
      These changes cause -fsyntax-only to not page in any sources from
      Cocoa.h.  We see a speedup of 27%.
      
      llvm-svn: 62193
      e9814186
  6. Jan 13, 2009
  7. Jan 09, 2009
    • Ted Kremenek's avatar
      Enhance PTH 'getSpelling' caching: · 47b8cf6d
      Ted Kremenek authored
      - Refactor caching logic into a helper class PTHSpellingSearch
      - Allow "random accesses" in the spelling cache, thus catching the remaining
        cases where 'getSpelling' wasn't hitting the PTH cache
        
      For -Eonly, PTH, Cocoa.h:
      - This reduces wall time by 3% (user time unchanged, sys time reduced)
      - This reduces the amount of paged source by 1112K.
        The remaining 1112K still being paged in is from somewhere else
        (investigating).
      
      llvm-svn: 62009
      47b8cf6d
    • Ted Kremenek's avatar
      Invert assertion condition. · 8ae06625
      Ted Kremenek authored
      llvm-svn: 61961
      8ae06625
  8. Jan 08, 2009
    • Ted Kremenek's avatar
      PTH: Hook up getSpelling() caching in PTHLexer. This results in a nice · d5e6e16d
      Ted Kremenek authored
      performance gain. Here's what we see for -Eonly on Cocoa.h (using PTH):
      
      - wall time decreases by 21% (26% speedup overall)
      - system time decreases by 35%
      - user time decreases by 6%
      
      These reductions are due to not paging source files just to get spellings for
      literals. The solution in place doesn't appear to be 100% yet, as we still see
      some of the pages for source files getting mapped in. Using -print-stats, we see
      that SourceManager maps in 7179K less bytes of source text (reduction of 75%).
      Will investigate why the remaining 25% are getting paged in.
      
      With these changes, here's how PTH compares to non-PTH on Cocoa.h:
        -Eonly: PTH takes 64% of the time as non-PTH (54% speedup)
        -fsyntax-only: PTH takes 89% of the time as non-PTH (11% speedup)
      
      llvm-svn: 61913
      d5e6e16d
    • Ted Kremenek's avatar
      PTH: · 884a5584
      Ted Kremenek authored
      - Added stub PTHLexer::getSpelling() that will be used for fetching cached
        spellings from the PTH file.  This doesn't do anything yet.
      - Added a hook in Preprocessor::getSpelling() to call PTHLexer::getSpelling()
        when using a PTHLexer.
      - Updated PTHLexer to read the offsets of spelling tables in the PTH file.
      
      llvm-svn: 61911
      884a5584
  9. Dec 23, 2008
    • Ted Kremenek's avatar
      PTH: Remove some methods and simplify some conditions in PTHLexer::Lex(). No... · 78cc2473
      Ted Kremenek authored
      PTH: Remove some methods and simplify some conditions in PTHLexer::Lex().  No big functionality change.
      
      llvm-svn: 61381
      78cc2473
    • Ted Kremenek's avatar
      PTH: Use 3 bytes instead of 4 bytes to encode the persistent ID for a token. · a754c403
      Ted Kremenek authored
      - This reduces the PTH size for Cocoa.h by 7%.
      - The increases PTH -Eonly speed for Cocoa.h by 0.8%.
      
      llvm-svn: 61377
      a754c403
    • Ted Kremenek's avatar
      3f94706e
    • Ted Kremenek's avatar
      PTH: · 1bd0a550
      Ted Kremenek authored
      - Encode the token length with 2 bytes instead of 4.
      - This reduces the size of the .pth file for Cocoa.h by 12%.
      - This speeds up PTH time (-Eonly) on Cocoa.h by 1.6%.
      
      llvm-svn: 61364
      1bd0a550
    • Ted Kremenek's avatar
      PTH: · 66076a96
      Ted Kremenek authored
      - In PTHLexer::Lex read all of the token data from PTH file before
        constructing the token.  The idea is to enhance locality.
      - Do not use Read8/Read32 in PTHLexer::Lex.  Inline these operations manually.
      - Change PTHManager::ReadIdentifierInfo() to PTHManager::GetIdentifierInfo().
        They are functionally the same except that PTHLexer::Lex() reads the
        persistent id.
      
      These changes result in a 3.3% speedup for PTH on Cocoa.h (-Eonly).
      
      llvm-svn: 61363
      66076a96
    • Ted Kremenek's avatar
      PTH: · 1b18ad24
      Ted Kremenek authored
      - Embed 'eom' tokens in PTH file.
      - Use embedded 'eom' tokens to not lazily generate them in the PTHLexer.
        This means that PTHLexer can always advance to the next token after
        reading a token (instead of buffering tokens using a copy).
      - Moved logic of 'ReadToken' into Lex.  GetToken & ReadToken no longer exist.
      - These changes result in a 3.3% speedup (-Eonly) on Cocoa.h.
      - The code is a little gross.  Many cleanups are possible and should be done.
      
      llvm-svn: 61360
      1b18ad24
  10. Dec 18, 2008
  11. Dec 17, 2008
  12. Dec 12, 2008
    • Ted Kremenek's avatar
      PTH: Added minor 'sibling jumping' optimization for iterating over the side... · 877556f4
      Ted Kremenek authored
      PTH: Added minor 'sibling jumping' optimization for iterating over the side table used for fast preprocessor block skipping.  This has a minor performance improvement when preprocessing Cocoa.h, but can have some wins in pathologic cases.
      
      llvm-svn: 60966
      877556f4
    • Ted Kremenek's avatar
      Added PTH optimization to not process entire blocks of tokens that appear in... · 56572ab9
      Ted Kremenek authored
      Added PTH optimization to not process entire blocks of tokens that appear in skipped preprocessor blocks.  This improves PTH speed by 6%.  The code for this optimization itself is not very optimized, and will get cleaned up.
      
      llvm-svn: 60956
      56572ab9
    • Ted Kremenek's avatar
      PTH: · 864eb392
      Ted Kremenek authored
      - Added a side-table per each token-cached file with the preprocessor conditional stack.  This tracks what #if's are matched with what #endifs and where their respective tokens are in the PTH file.  This will allow for quick skipping of excluded conditional branches in the Preprocessor.
      - Performance testing shows the addition of this information (without actually utilizing it) leads to no performance regressions.
      
      llvm-svn: 60911
      864eb392
  13. Dec 11, 2008
  14. Dec 10, 2008
  15. Dec 04, 2008
  16. Dec 03, 2008
    • Ted Kremenek's avatar
      PTH: · 73a4d287
      Ted Kremenek authored
      Use an array instead of a DenseMap to cache persistent IDs -> IdentifierInfo*.  This leads to a 4% speedup at -fsyntax-only using PTH.
      
      llvm-svn: 60452
      73a4d287
    • Ted Kremenek's avatar
      - Remove PTHManager.cpp. Move all of its functions to PTHLexer.cpp since some... · 33eeabda
      Ted Kremenek authored
      - Remove PTHManager.cpp.  Move all of its functions to PTHLexer.cpp since some of the internal methods are used by PTHLexer (their implementations are intertwined.)  This enables some important inlining opportunities at -O3.
      
      - Don't construct an std::vector<Token> prior to feeding PTH tokens to the Preprocessor.  Stream them off the PTH file directly.
      
      llvm-svn: 60447
      33eeabda
  17. Nov 27, 2008
  18. Nov 22, 2008
  19. Nov 21, 2008
    • Ted Kremenek's avatar
      PTHLexer: · 53ab374d
      Ted Kremenek authored
      - Move out logic for handling the end-of-file to LexEndOfFile (to match the Lexer) class.  The logic now mirrors the Lexer class more, which allows us to pass most of the Preprocessor test cases.
      
      llvm-svn: 59768
      53ab374d
  20. Nov 20, 2008
    • Ted Kremenek's avatar
      PTHLexer: · 111caaac
      Ted Kremenek authored
      - Move PTHLexer::GetToken() to be inside PTHLexer.cpp.
      - When lexing in raw mode, null out identifiers.
      
      llvm-svn: 59744
      111caaac
Loading