Performance: Add an index to Change cmLocalGenerator::GeneratorTargets.

Add an index to Change cmLocalGenerator::GeneratorTargets for faster lookup by
name.

Also changed a bunch of uses of cmLocalGenerator::GetGeneratorTargets() to take
const references instead of copying the vector.

Represent generator targets as a map (name -> target) to make name lookups more
efficient instead of looping through the entire vector to find the desired one.
This commit is contained in:
Aaron Orenstein
2017-08-11 14:11:18 -07:00
parent c47c011c77
commit af3fd6f22f
14 changed files with 71 additions and 57 deletions
+5 -1
View File
@@ -16,6 +16,7 @@
#include "cmOutputConverter.h"
#include "cmPolicies.h"
#include "cmStateSnapshot.h"
#include "cm_unordered_map.hxx"
#include "cmake.h"
class cmComputeLinkInformation;
@@ -353,8 +354,11 @@ protected:
std::string::size_type ObjectPathMax;
std::set<std::string> ObjectMaxPathViolations;
std::set<cmGeneratorTarget const*> WarnCMP0063;
typedef CM_UNORDERED_MAP<std::string, cmGeneratorTarget*> GeneratorTargetMap;
GeneratorTargetMap GeneratorTargetSearchIndex;
std::vector<cmGeneratorTarget*> GeneratorTargets;
std::set<cmGeneratorTarget const*> WarnCMP0063;
std::vector<cmGeneratorTarget*> ImportedGeneratorTargets;
std::vector<cmGeneratorTarget*> OwnedImportedGeneratorTargets;
std::map<std::string, std::string> AliasTargets;