summaryrefslogtreecommitdiff
path: root/src/protocols/Screencopy.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2025-01-19 10:38:42 +0000
committerGitHub <noreply@github.com>2025-01-19 10:38:42 +0000
commit4da9b7cc5b50c346309378fbb5ae8aa07746fd33 (patch)
treea618fb83c13bac02729751d866a884e7207d08e7 /src/protocols/Screencopy.cpp
parentf56153a9c1b0a00fac0932a95e0cfa5a4f6c681f (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/Screencopy.cpp')
-rw-r--r--src/protocols/Screencopy.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp
index 8bdaf8f9..5cf54eb4 100644
--- a/src/protocols/Screencopy.cpp
+++ b/src/protocols/Screencopy.cpp
@@ -412,6 +412,8 @@ void CScreencopyProtocol::onOutputCommit(PHLMONITOR pMonitor) {
}
std::vector<WP<CScreencopyFrame>> framesToRemove;
+ // reserve number of elements to avoid reallocations
+ framesToRemove.reserve(m_vFramesAwaitingWrite.size());
// share frame if correct output
for (auto const& f : m_vFramesAwaitingWrite) {