-
- Downloads
Implement parsing cache for the LookupHelper.
The operations done by the LookupHelper are costly in both memory and performance. Almost every operation requires memory allocation and parsing of often non-trivial C++ code. Unfortunately, the LookupHelper is used very intensively by rootcling and ROOT. The callers usually do not use any caching mechanisms and redo the expensive operations over and over even though the answer is known to be the same as before. For instance, building the dictionary of shows: ``` MathCore: Cached entries: 217 Total parse requests: 54051 Cache hits: 53834 TreePlayer: Cached entries: 183 Total parse requests: 57697 Cache hits: 57514 ``` This patch introduces the first set of caching functionality. In particular, each LookupHelper::find* function allocates a memory buffer which is then stored in the clang::SourceManager. We hash the buffer content and keep a mapping between a hash and FileID and next time we encounter the same content we do not allocate a new FileID but reuse the old one. We see decrease in memory footprint by 7% for non-cxxmodules ROOT. For cxxmodules we see significant reduction of the pcm sizes (by half) which translates into rss improvements: ``` master before: cpu time = 0.291462 seconds sys time = 0.064409 seconds res memory = 345.816 Mbytes vir memory = 573.508 Mbytes master after: cpu time = 0.235828 seconds sys time = 0.098327 seconds res memory = 260.012 Mbytes vir memory = 377.945 Mbytes ``` Patch by Yuka Takahashi and me.
Showing
- interpreter/cling/include/cling/Interpreter/LookupHelper.h 17 additions, 2 deletionsinterpreter/cling/include/cling/Interpreter/LookupHelper.h
- interpreter/cling/lib/Interpreter/LookupHelper.cpp 137 additions, 58 deletionsinterpreter/cling/lib/Interpreter/LookupHelper.cpp
- interpreter/llvm/src/tools/clang/include/clang/Basic/SourceManager.h 3 additions, 2 deletions.../llvm/src/tools/clang/include/clang/Basic/SourceManager.h
Loading
Please register or sign in to comment