From 4da9b7cc5b50c346309378fbb5ae8aa07746fd33 Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Sun, 19 Jan 2025 10:38:42 +0000 Subject: 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. --- src/protocols/DRMLease.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/protocols/DRMLease.cpp') diff --git a/src/protocols/DRMLease.cpp b/src/protocols/DRMLease.cpp index fce1e345..6fdbaf4b 100644 --- a/src/protocols/DRMLease.cpp +++ b/src/protocols/DRMLease.cpp @@ -34,6 +34,9 @@ CDRMLeaseResource::CDRMLeaseResource(SP resource_, SP> outputs; + // reserve to avoid reallocations + outputs.reserve(requested.size()); + for (auto const& m : requested) { outputs.emplace_back(m->monitor->output); } -- cgit v1.2.3