Avoid repeated erase+reorder when resetting pagesets

This commit is contained in:
baldurk
2022-10-14 14:44:07 +01:00
parent e38b4e0fff
commit 0dbb38c92e
+4 -1
View File
@@ -1154,7 +1154,10 @@ void ChunkPagePool::ResetPageSet(const rdcarray<ChunkPage> &pages)
alloc.chunkHead = alloc.chunkBase;
// move to free list
freePages.push_back(alloc);
allocatedPages.erase(idx);
// allocatedPages is not sorted, swap with the back and pop to avoid expensive erases in the
// middle of the list
std::swap(allocatedPages[idx], allocatedPages.back());
allocatedPages.pop_back();
continue;
}
}