Repository navigation
[core] ACLiC: skip dependency scan for explicitly linked libraries - #23538
guitargeek wants to merge 1 commit into
Conversation
When loading an ACLiC library with C++ modules enabled and no rootmap file, `LoadLibrary` first resolves the library's dependencies by scanning its undefined symbols (`GetSharedLibDeps` with `tryDyld`) and loading each library that provides them. This is not needed if the library was explicitly linked against its dependencies (`ACLiC.LinkLibs & 1`, the default on Linux and macOS): they are then recorded in the library itself and loaded by the dynamic linker. The scan is expensive though. For a macro that uses RDataFrame, RooFit, Tree, Hist and Gpad, it takes about 2.9 s, making `.L macro.C+` with an up-to-date library take 4.9 s instead of 2.35 s (loading the library directly takes 2.2 s). Only do the scan if the library is not explicitly linked. This is the core part of root-project#8017. 🤖 Done with the help of AI
Test Results 23 files 23 suites 3d 12h 37m 9s ⏱️ Results for commit 2f53e69. ♻️ This comment has been updated with latest results. |
| // We have no rootmap files or modules to construct `-l` flags enabling | ||
| // explicit linking. We have to resolve the dependencies by ourselves | ||
| // taking the job of the dyld. | ||
| auto LoadLibrary = [linkDepLibraries, useCxxModules, produceRootmap, ForeachSharedLibDep](const TString &lib) { |
There was a problem hiding this comment.
The only semantic problem I see here is that 'linkDepLibraries' is about how we will construct the upcoming library and not whether the library we are linking against are all fully explicitly linked :( ..
There was a problem hiding this comment.
should it be maybe called preLoadDepLibraries instead?
There was a problem hiding this comment.
I was trying to address with minimal changes your comment I think
There was a problem hiding this comment.
I might not have been clear. The flag linkDepLibraries only change how the ACLiC libraries are generated, however it does not tell anything about any other libraries. Thus for a given library in the list we still don't know if the deep search is needed or not as that library might or might be explicitly linked to its dependencies.
When loading an ACLiC library with C++ modules enabled and no rootmap file,
LoadLibraryfirst resolves the library's dependencies by scanning its undefined symbols (GetSharedLibDepswithtryDyld) and loading each library that provides them.This is not needed if the library was explicitly linked against its dependencies (
ACLiC.LinkLibs & 1, the default on Linux and macOS): they are then recorded in the library itself and loaded by the dynamic linker. The scan is expensive though. For a macro that uses RDataFrame, RooFit, Tree, Hist and Gpad, it takes about 2.9 s, making.L macro.C+with an up-to-date library take 4.9 s instead of 2.35 s (loading the library directly takes 2.2 s).Only do the scan if the library is not explicitly linked.
This is the core part of #8017.