mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-09-16 00:08:26 +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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user