summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-08 17:37:47 (GMT)
committerBrad King <brad.king@kitware.com>2016-02-08 18:08:11 (GMT)
commit6cbf6a51976c9092f84ef4a90d35fb6fd60f5898 (patch)
tree3dfad2feee26d2e3d7100655029dbc4d2d27ab26 /Source/cmMakefile.cxx
parenta5a5a6857241c21d306661d723b749839f4c6e1a (diff)
downloadCMake-6cbf6a51976c9092f84ef4a90d35fb6fd60f5898.zip
CMake-6cbf6a51976c9092f84ef4a90d35fb6fd60f5898.tar.gz
CMake-6cbf6a51976c9092f84ef4a90d35fb6fd60f5898.tar.bz2
Fix internal target lookup performance regression
Refactoring in commit v3.5.0-rc1~272^2~13 (cmGlobalGenerator: Remove direct storage of targets, 2015-10-25) replaced an efficient data structure mapping from target name to cmTarget instance with a linear search. Lookups through cmGlobalGenerator::FindTarget are done a lot. Restore the efficient mapping structure with a name indicating its purpose. Reported-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx2
1 files changed, 2 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index cba29eb..950b247 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2128,6 +2128,7 @@ cmMakefile::AddNewTarget(cmState::TargetType type, const std::string& name)
cmTarget& target = it->second;
target.SetType(type, name);
target.SetMakefile(this);
+ this->GetGlobalGenerator()->IndexTarget(&it->second);
return &it->second;
}
@@ -4218,6 +4219,7 @@ cmMakefile::AddImportedTarget(const std::string& name,
// Add to the set of available imported targets.
this->ImportedTargets[name] = target.get();
+ this->GetGlobalGenerator()->IndexTarget(target.get());
// Transfer ownership to this cmMakefile object.
this->ImportedTargetsOwned.push_back(target.get());