mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-09 00:21:56 -07: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:
@@ -393,6 +393,8 @@ void CToplevelExportProtocol::onOutputCommit(PHLMONITOR pMonitor) {
|
||||
return; // nothing to share
|
||||
|
||||
std::vector<WP<CToplevelExportFrame>> framesToRemove;
|
||||
// reserve number of elements to avoid reallocations
|
||||
framesToRemove.reserve(m_vFramesAwaitingWrite.size());
|
||||
|
||||
// share frame if correct output
|
||||
for (auto const& f : m_vFramesAwaitingWrite) {
|
||||
|
Reference in New Issue
Block a user