macOS: Speed up rpath install name dir lookup with a cache
This MR provides a speedup for larger MacOS projects by introducing a new cache in cmGeneratorTarget
. The issue has been described in #20602 (closed).
In particular, the lookup table is a nested hash map with the configuration (std::string
) as the primary and the cmTarget*
pointer the secondary key. While it would be nicer to have a single std::pair<std::string, cmTarget*>
key, as far as I can see there is no project-wide utility to properly combine hashes (similar to boost::hash_combine
), so I chose the nested approach. It has the desired affect, and while I couldn't reproduce the same speedup as described in the issue, my test runs showed a worthwile 1.1x speedup for one large project under consideration.
Here's a screenshot of the profile of the cmake
invocation in an already configured build directory (using Apple's "Instruments" frontend to dtrace
, i.e. this is from the usual stacktrace samples). The rectangle highlights the function in question with 8.5% of the total time spent (this is without the patch this MR provides. With this patch, the function drops below 0.5%.
Fixes: #20602 (closed)
Topic-rename: macos-cache-rpath-install-namedir