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/managers/KeybindManager.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/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index a1979206..65891840 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1891,9 +1891,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) { // apply // we make a copy because changeWindowFloatingMode might invalidate the iterator - std::vector<PHLWINDOW> ptrs; - for (auto const& w : g_pCompositor->m_vWindows) - ptrs.push_back(w); + std::vector<PHLWINDOW> ptrs(g_pCompositor->m_vWindows.begin(), g_pCompositor->m_vWindows.end()); for (auto const& w : ptrs) { if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden()) |
