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;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int size() const { return _size; }
|
unsigned int size() const { return _size; }
|
||||||
|
unsigned int capacity() const { return _capacity; }
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,11 +72,11 @@ bool FilesystemNode::getChildren(FSList& fslist, ListMode mode, bool hidden) con
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AbstractFSList tmp;
|
AbstractFSList tmp;
|
||||||
|
tmp.reserve(fslist.capacity());
|
||||||
|
|
||||||
if (!_realNode->getChildren(tmp, mode, hidden))
|
if (!_realNode->getChildren(tmp, mode, hidden))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fslist.clear();
|
|
||||||
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i)
|
for (AbstractFSList::iterator i = tmp.begin(); i != tmp.end(); ++i)
|
||||||
{
|
{
|
||||||
fslist.push_back(FilesystemNode(*i));
|
fslist.push_back(FilesystemNode(*i));
|
||||||
|
|
|
@ -168,6 +168,7 @@ void BrowserDialog::updateListing()
|
||||||
|
|
||||||
// Read in the data from the file system
|
// Read in the data from the file system
|
||||||
FSList content;
|
FSList content;
|
||||||
|
content.reserve(2048);
|
||||||
_node.getChildren(content, _mode);
|
_node.getChildren(content, _mode);
|
||||||
|
|
||||||
// Add '[..]' to indicate previous folder
|
// Add '[..]' to indicate previous folder
|
||||||
|
|
|
@ -345,7 +345,7 @@ void LauncherDialog::loadDirListing()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FSList files;
|
FSList files;
|
||||||
files.reserve(1024);
|
files.reserve(2048);
|
||||||
myCurrentNode.getChildren(files, FilesystemNode::kListAll);
|
myCurrentNode.getChildren(files, FilesystemNode::kListAll);
|
||||||
|
|
||||||
// Add '[..]' to indicate previous folder
|
// Add '[..]' to indicate previous folder
|
||||||
|
|
|
@ -127,6 +127,7 @@ void RomAuditDialog::auditRoms()
|
||||||
|
|
||||||
FilesystemNode node(auditPath);
|
FilesystemNode node(auditPath);
|
||||||
FSList files;
|
FSList files;
|
||||||
|
files.reserve(2048);
|
||||||
node.getChildren(files, FilesystemNode::kListFilesOnly);
|
node.getChildren(files, FilesystemNode::kListFilesOnly);
|
||||||
|
|
||||||
// Create a progress dialog box to show the progress of processing
|
// Create a progress dialog box to show the progress of processing
|
||||||
|
|
Loading…
Reference in New Issue