mirror of
https://github.com/hyprwm/Hyprland.git
synced 2026-02-05 14:35:44 +00:00
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.
This commit is contained in:
@ -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())
|
||||
|
||||
Reference in New Issue
Block a user