NANCY: Add reserve() calls before initializing arrays

Added calls to reserve() before initializing most arrays in the engine to reduce unnecessary allocations when pushing back elements one by one.
This commit is contained in:
fracturehill 2021-03-20 18:18:29 +02:00 committed by Eugene Sandulenko
parent 99da486454
commit bfc6586f78
18 changed files with 72 additions and 23 deletions

View file

@ -38,6 +38,7 @@ void CursorManager::init() {
Common::String inventoryCursorsImageName = chunk->readString();
chunk = g_nancy->getBootChunkStream("CURS");
_cursors.reserve(56);
for (uint i = 0; i < 56; ++i) {
_cursors.push_back(Cursor());
chunk->seek(i * 16, SEEK_SET);