diff options
author | Chris Lattner <sabre@nondot.org> | 2007-07-15 00:25:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-07-15 00:25:26 +0000 |
commit | 9594acf32de2939b15eafa8fe818607bfc56bf66 (patch) | |
tree | 7a6b83a0b4ddccddcd1c4e8de7d89edc09b0e39d /include/clang/Lex/Preprocessor.h | |
parent | 9e344c65b1e8b83e1d3ada507cf653526ff2c005 (diff) |
Cache macro expander objects to avoid thrashing malloc in heavy expansion situations.
This doesn't significantly improve carbon.h, but it does speed up
INPUTS/macro_pounder_obj.c by 48%
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index e3aff76012..4b6ea1f436 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -114,6 +114,11 @@ class Preprocessor { unsigned NumMacroExpanded, NumFnMacroExpanded, NumBuiltinMacroExpanded; unsigned NumFastMacroExpanded, NumTokenPaste, NumFastTokenPaste; unsigned NumSkipped; + + /// MacroExpanderCache - Cache macro expanders to reduce malloc traffic. + enum { MacroExpanderCacheSize = 8 }; + unsigned NumCachedMacroExpanders; + MacroExpander *MacroExpanderCache[MacroExpanderCacheSize]; public: Preprocessor(Diagnostic &diags, const LangOptions &opts, TargetInfo &target, SourceManager &SM, HeaderSearch &Headers); |