diff options
| author | Tom Englund <tomenglund26@gmail.com> | 2025-01-19 10:38:42 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-19 10:38:42 +0000 |
| commit | 4da9b7cc5b50c346309378fbb5ae8aa07746fd33 (patch) | |
| tree | a618fb83c13bac02729751d866a884e7207d08e7 /src/protocols/DRMLease.cpp | |
| parent | f56153a9c1b0a00fac0932a95e0cfa5a4f6c681f (diff) | |
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.
Diffstat (limited to 'src/protocols/DRMLease.cpp')
| -rw-r--r-- | src/protocols/DRMLease.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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<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); } |
