mirror of https://github.com/stella-emu/stella.git
Potential performance improvement for Arrays. A reserve() method is now
available, which helps with constant resizes of arrays with a large number of push_backs. For now, only the ROM launcher and debugger disassembly really needs it. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2442 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
1bcdbbd3f8
commit
809da97ad3
|
@ -58,6 +58,13 @@ class Array
|
||||||
delete [] _data;
|
delete [] _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reserve(int capacity)
|
||||||
|
{
|
||||||
|
if(capacity <= _capacity)
|
||||||
|
return;
|
||||||
|
ensureCapacity(capacity - 128);
|
||||||
|
}
|
||||||
|
|
||||||
void push_back(const T& element)
|
void push_back(const T& element)
|
||||||
{
|
{
|
||||||
ensureCapacity(_size + 1);
|
ensureCapacity(_size + 1);
|
||||||
|
|
|
@ -278,6 +278,7 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, bool resolvedata, uInt16 sea
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
myDisassembly.list.clear();
|
myDisassembly.list.clear();
|
||||||
|
myDisassembly.list.reserve(2048);
|
||||||
myDisassembly.fieldwidth = 10 + myLabelLength;
|
myDisassembly.fieldwidth = 10 + myLabelLength;
|
||||||
DiStella distella(*this, myDisassembly.list, info,
|
DiStella distella(*this, myDisassembly.list, info,
|
||||||
myDisLabels, myDisDirectives, resolvedata);
|
myDisLabels, myDisDirectives, resolvedata);
|
||||||
|
|
|
@ -345,6 +345,7 @@ void LauncherDialog::loadDirListing()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FSList files;
|
FSList files;
|
||||||
|
files.reserve(1024);
|
||||||
myCurrentNode.getChildren(files, FilesystemNode::kListAll);
|
myCurrentNode.getChildren(files, FilesystemNode::kListAll);
|
||||||
|
|
||||||
// Add '[..]' to indicate previous folder
|
// Add '[..]' to indicate previous folder
|
||||||
|
|
Loading…
Reference in New Issue