mirror of https://github.com/stella-emu/stella.git
A few more places where it makes sense to pre-allocate space for
Arrays. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2443 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
809da97ad3
commit
ccf9128cdf
|
@ -131,7 +131,8 @@ class Array
|
|||
return *this;
|
||||
}
|
||||
|
||||
unsigned int size() const { return _size; }
|
||||
unsigned int size() const { return _size; }
|
||||
unsigned int capacity() const { return _capacity; }
|
||||
|
||||
void clear()
|
||||
{
|
||||
|
|
|
@ -72,11 +72,11 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode, bool hidden) con
|
|||
return false;
|
||||
|
||||
AbstractFSList tmp;
|
||||
tmp.reserve(fslist.capacity());
|
||||
|
||||
if (!_realNode->getChildren(tmp, mode, hidden))
|
||||
return false;
|
||||
|
||||
fslist.clear();
|
||||
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i)
|
||||
{
|
||||
fslist.push_back(FilesystemNode(*i));
|
||||
|
|
|
@ -168,6 +168,7 @@ void BrowserDialog::updateListing()
|
|||
|
||||
// Read in the data from the file system
|
||||
FSList content;
|
||||
content.reserve(2048);
|
||||
_node.getChildren(content, _mode);
|
||||
|
||||
// Add '[..]' to indicate previous folder
|
||||
|
|
|
@ -345,7 +345,7 @@ void LauncherDialog::loadDirListing()
|
|||
return;
|
||||
|
||||
FSList files;
|
||||
files.reserve(1024);
|
||||
files.reserve(2048);
|
||||
myCurrentNode.getChildren(files, FilesystemNode::kListAll);
|
||||
|
||||
// Add '[..]' to indicate previous folder
|
||||
|
|
|
@ -127,6 +127,7 @@ void RomAuditDialog::auditRoms()
|
|||
|
||||
FilesystemNode node(auditPath);
|
||||
FSList files;
|
||||
files.reserve(2048);
|
||||
node.getChildren(files, FilesystemNode::kListFilesOnly);
|
||||
|
||||
// Create a progress dialog box to show the progress of processing
|
||||
|
|
Loading…
Reference in New Issue