whitepaper: 352/169 — wave4 MEDIUM (hadoop/hbase/nova/neutron/openstack) + fix odl-0002 dup

This commit is contained in:
russell@unturf.com 2026-03-27 15:33:17 -04:00
parent 9934133dcf
commit 835ae73b0f
82 changed files with 5931 additions and 6 deletions

View file

@ -0,0 +1,30 @@
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index abc1234..def5678 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -456,14 +456,19 @@ std::vector<BT<std::string>>
cmComputeLinkInformation::GetDirectoriesWithBacktraces()
{
std::vector<BT<std::string>> directoriesWithBacktraces;
std::vector<BT<std::string>> targetLinkDirectories =
this->Target->GetLinkDirectories(this->Config, this->LinkLanguage);
+ // Build an index from directory string → BT entry for O(1) lookup.
+ std::unordered_map<std::string, BT<std::string>> dirIndex;
+ dirIndex.reserve(targetLinkDirectories.size());
+ for (auto& bt : targetLinkDirectories)
+ dirIndex.emplace(bt.Value, std::move(bt));
+
std::vector<std::string> const& orderedDirectories = this->GetDirectories();
for (std::string const& dir : orderedDirectories) {
- auto result = std::find(targetLinkDirectories.begin(),
- targetLinkDirectories.end(), dir);
- if (result != targetLinkDirectories.end()) {
- directoriesWithBacktraces.emplace_back(std::move(*result));
+ auto result = dirIndex.find(dir);
+ if (result != dirIndex.end()) {
+ directoriesWithBacktraces.emplace_back(std::move(result->second));
} else {
directoriesWithBacktraces.emplace_back(dir);
}

View file

@ -0,0 +1,31 @@
diff --git a/Source/cmComputeLinkInformation.h b/Source/cmComputeLinkInformation.h
index abc1234..def5678 100644
--- a/Source/cmComputeLinkInformation.h
+++ b/Source/cmComputeLinkInformation.h
@@ -1,6 +1,7 @@
#pragma once
#include <map>
+#include <unordered_set>
#include <vector>
// ... (other includes unchanged)
@@ -180,7 +181,9 @@ private:
// DLL dependencies to copy at runtime (Windows/DLL platforms only).
// Populated by AddRuntimeDLL(), queried by GetRuntimeDLLs().
std::vector<cmGeneratorTarget const*> RuntimeDLLs;
+ // Shadow set for O(1) membership check in AddRuntimeDLL.
+ std::unordered_set<cmGeneratorTarget const*> RuntimeDLLsSet;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index abc1234..def5678 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1350,8 +1350,9 @@ void cmComputeLinkInformation::AddRuntimeDLL(cmGeneratorTarget const* tgt)
{
- if (std::find(this->RuntimeDLLs.begin(), this->RuntimeDLLs.end(), tgt) ==
- this->RuntimeDLLs.end()) {
+ if (this->RuntimeDLLsSet.insert(tgt).second) {
this->RuntimeDLLs.emplace_back(tgt);
}
}

View file

@ -0,0 +1,28 @@
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index abc1234..def5678 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1428,11 +1428,19 @@ cmSourceFile* cmTarget::AddSource(std::string const& src, bool before)
{
cmSourceFileLocation sfl(this->impl->Makefile, src,
cmSourceFileLocationKind::Known);
+ // Fast path: check a parallel unordered_set of source-path strings.
+ // The full TargetPropertyEntryFinder scan is O(n) and is called from loops
+ // (e.g. Unity build file iteration), producing O(n^2) overall.
+ // An exact-string set lookup is O(1) amortized and covers the common case
+ // where src is a canonical resolved path.
+ if (!this->impl->SourcePathsSet.insert(src).second) {
+ // Already present — skip the expensive find_if and WriteDirect.
+ if (cmGeneratorExpression::Find(src) != std::string::npos)
+ return nullptr;
+ return this->impl->Makefile->GetOrCreateSource(
+ src, false, cmSourceFileLocationKind::Known);
+ }
auto const& sources = this->impl->Sources.Entries;
if (std::find_if(sources.begin(), sources.end(),
TargetPropertyEntryFinder(sfl)) == sources.end()) {
this->impl->Sources.WriteDirect(
this->impl.get(), {}, cmValue(src),
before ? UsageRequirementProperty::Action::Prepend
: UsageRequirementProperty::Action::Append);
}