core: reserve vector sizes as much as we can (#9118)

avoid reallocations as much as possible with a few edge cases where the
reservation overshoots a tiny bit. but a few bytes of memory short term
is better used then the overhead of potential reallocation.
This commit is contained in:
Tom Englund
2025-01-19 10:38:42 +00:00
committed by GitHub
parent f56153a9c1
commit 4da9b7cc5b
11 changed files with 45 additions and 12 deletions

View File

@@ -34,6 +34,9 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
}());
std::vector<SP<Aquamarine::IOutput>> outputs;
// reserve to avoid reallocations
outputs.reserve(requested.size());
for (auto const& m : requested) {
outputs.emplace_back(m->monitor->output);
}