diff --git a/src/common/Array.hxx b/src/common/Array.hxx index a33834ad5..691424432 100644 --- a/src/common/Array.hxx +++ b/src/common/Array.hxx @@ -58,6 +58,13 @@ class Array delete [] _data; } + void reserve(int capacity) + { + if(capacity <= _capacity) + return; + ensureCapacity(capacity - 128); + } + void push_back(const T& element) { ensureCapacity(_size + 1); diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index fcb223096..763b9d8c5 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -278,6 +278,7 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, bool resolvedata, uInt16 sea bool found = false; myDisassembly.list.clear(); + myDisassembly.list.reserve(2048); myDisassembly.fieldwidth = 10 + myLabelLength; DiStella distella(*this, myDisassembly.list, info, myDisLabels, myDisDirectives, resolvedata); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index f217083dc..38bb3bdd2 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -345,6 +345,7 @@ void LauncherDialog::loadDirListing() return; FSList files; + files.reserve(1024); myCurrentNode.getChildren(files, FilesystemNode::kListAll); // Add '[..]' to indicate previous folder