summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.h
diff options
context:
space:
mode:
authorMatthias Maennich <matthias@maennich.net>2017-08-31 07:10:46 (GMT)
committerBrad King <brad.king@kitware.com>2017-09-19 15:21:36 (GMT)
commit7374cb857cc509daa7bf6dc44630f51e080bc054 (patch)
tree152e48d3b02cb12bbf188348298ab460b4c6bf25 /Source/cmGlobalNinjaGenerator.h
parented19e8136d59d4ae7fbee20d9a549f4c06237e59 (diff)
downloadCMake-7374cb857cc509daa7bf6dc44630f51e080bc054.zip
CMake-7374cb857cc509daa7bf6dc44630f51e080bc054.tar.gz
CMake-7374cb857cc509daa7bf6dc44630f51e080bc054.tar.bz2
Ninja: Cache ConvertToNinjaPath results to avoid repeat work
Calls to this method may dominate generation time in some cases. Measurements for configuring cmake itself show a cache hit rate of ~57% (7753 total calls, 4453 cache hits). For a larger project (that also makes use of custom targets as prerequisite for all compile targets), the measured cache hit ratio is ~96% (2530827 total calls, 2433124 cache hits). For this project the observable cmake runtime could be reduced from 40s to 30s. Signed-off-by: Matthias Maennich <matthias@maennich.net>
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.h')
-rw-r--r--Source/cmGlobalNinjaGenerator.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 00bf91c..7f80d08 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -9,6 +9,7 @@
#include <map>
#include <set>
#include <string>
+#include <unordered_map>
#include <utility>
#include <vector>
@@ -245,7 +246,7 @@ public:
return this->RulesFileStream;
}
- std::string ConvertToNinjaPath(const std::string& path) const;
+ std::string const& ConvertToNinjaPath(const std::string& path) const;
struct MapToNinjaPathImpl
{
@@ -452,6 +453,9 @@ private:
std::map<cmGeneratorTarget const*, cmNinjaOuts> TargetDependsClosures;
+ /// the local cache for calls to ConvertToNinjaPath
+ mutable std::unordered_map<std::string, std::string> ConvertToNinjaPathCache;
+
std::string NinjaCommand;
std::string NinjaVersion;
bool NinjaSupportsConsolePool;