[cxxmodules] Autoload less libraries
In previous allmodules&autoloading patch, we used callback from DeserializationListener to get Decl and loaded corresponding libraries. It worked, but the performance was bad because ROOT was loading excessive libraries. In this patch, we use TCling::LazyFunctionCreatorAutoloadForModule. This function gets callback when "mangled_name" was not found in loaded libraries thus we have to the load corresponding library and lookup again. I used unordered_map to store mangled identifier and library pair. I'm doing an optimization by hashing mangled name and storing library not by name but by uint8 and hold uint8-name information in another vector. Also tried std::map but unorderd_map was more performant. There are better hash table like: https://probablydance.com/2018/05/28/a-new-fast-hash-table-in-response-to-googles-new-fast-hash-table/ we can try to use them if this part gets crucial. With this patch: ``` Processing tutorials/hsimple.C... hsimple : Real Time = 0.04 seconds Cpu Time = 0.03 seconds (TFile *) 0x562b37a14fe0 Processing /home/yuka/CERN/ROOT/memory.C... cpu time = 0.362307 seconds sys time = 0.039741 seconds res memory = 278.215 Mbytes vir memory = 448.973 Mbytes ``` W/o this patch: ``` Processing tutorials/hsimple.C... hsimple : Real Time = 0.08 seconds Cpu Time = 0.07 seconds (TFile *) 0x5563018a1d30 Processing /home/yuka/CERN/ROOT/memory.C... cpu time = 1.524314 seconds sys time = 0.157075 seconds res memory = 546.867 Mbytes vir memory = 895.184 Mbytes ``` So it improves time by 4x times and memory by 2x.
Showing
- core/clingutils/src/TClingUtils.cxx 0 additions, 5 deletionscore/clingutils/src/TClingUtils.cxx
- core/metacling/src/TCling.cxx 100 additions, 29 deletionscore/metacling/src/TCling.cxx
- core/metacling/src/TClingBaseClassInfo.cxx 2 additions, 11 deletionscore/metacling/src/TClingBaseClassInfo.cxx
- core/metacling/src/TClingCallbacks.cxx 0 additions, 24 deletionscore/metacling/src/TClingCallbacks.cxx
- core/metacling/src/TClingCallbacks.h 0 additions, 7 deletionscore/metacling/src/TClingCallbacks.h
- core/metacling/src/TClingClassInfo.cxx 0 additions, 4 deletionscore/metacling/src/TClingClassInfo.cxx
- core/metacling/src/TClingDataMemberInfo.cxx 0 additions, 3 deletionscore/metacling/src/TClingDataMemberInfo.cxx
- core/metacling/src/TClingTypeInfo.cxx 0 additions, 4 deletionscore/metacling/src/TClingTypeInfo.cxx
- interpreter/cling/include/cling/Interpreter/InterpreterCallbacks.h 0 additions, 7 deletions...er/cling/include/cling/Interpreter/InterpreterCallbacks.h
- interpreter/cling/include/cling/Interpreter/Transaction.h 0 additions, 17 deletionsinterpreter/cling/include/cling/Interpreter/Transaction.h
- interpreter/cling/lib/Interpreter/DeclCollector.cpp 0 additions, 13 deletionsinterpreter/cling/lib/Interpreter/DeclCollector.cpp
- interpreter/cling/lib/Interpreter/DeclCollector.h 1 addition, 8 deletionsinterpreter/cling/lib/Interpreter/DeclCollector.h
- interpreter/cling/lib/Interpreter/IncrementalParser.cpp 0 additions, 8 deletionsinterpreter/cling/lib/Interpreter/IncrementalParser.cpp
- interpreter/cling/lib/Interpreter/Interpreter.cpp 0 additions, 3 deletionsinterpreter/cling/lib/Interpreter/Interpreter.cpp
- interpreter/cling/lib/Interpreter/LookupHelper.cpp 1 addition, 1 deletioninterpreter/cling/lib/Interpreter/LookupHelper.cpp
- interpreter/cling/lib/Interpreter/MultiplexInterpreterCallbacks.h 0 additions, 6 deletions...ter/cling/lib/Interpreter/MultiplexInterpreterCallbacks.h
- interpreter/llvm/src/tools/clang/include/clang/Serialization/ASTReader.h 0 additions, 4 deletions...m/src/tools/clang/include/clang/Serialization/ASTReader.h
Loading
Please register or sign in to comment