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/desktop/Window.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/desktop') diff --git a/src/desktop/Window.cpp b/src/desktop/Window.cpp index 241a17d7..829f4e2e 100644 --- a/src/desktop/Window.cpp +++ b/src/desktop/Window.cpp @@ -282,6 +282,8 @@ void CWindow::updateWindowDecos() { // make a copy because updateWindow can remove decos. std::vector decos; + // reserve to avoid reallocations + decos.reserve(m_dWindowDecorations.size()); for (auto const& wd : m_dWindowDecorations) { decos.push_back(wd.get()); -- cgit v1.2.3