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:
parent
f56153a9c1
commit
4da9b7cc5b
11 changed files with 45 additions and 12 deletions
|
|
@ -122,6 +122,9 @@ void CDecorationPositioner::onWindowUpdate(PHLWINDOW pWindow) {
|
|||
|
||||
//
|
||||
std::vector<CDecorationPositioner::SWindowPositioningData*> datas;
|
||||
// reserve to avoid reallocations
|
||||
datas.reserve(pWindow->m_dWindowDecorations.size());
|
||||
|
||||
for (auto const& wd : pWindow->m_dWindowDecorations) {
|
||||
datas.push_back(getDataFor(wd.get(), pWindow));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue