Speedup for filebrowser when opening folders with a lot of files, #3951

This commit is contained in:
heckflosse 2017-07-06 15:26:12 +02:00
parent 21d388d7ee
commit b1dd97dac5

View File

@ -600,13 +600,18 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
{
MYWRITERLOCK(l, entryRW);
std::vector<ThumbBrowserEntryBase*>::iterator i = fd.begin();
while (i != fd.end() && *entry < * ((FileBrowserEntry*)*i)) {
++i;
}
fd.insert (i, entry);
fd.insert(
std::lower_bound(
fd.begin(),
fd.end(),
(ThumbBrowserEntryBase*)entry,
[](ThumbBrowserEntryBase* a, ThumbBrowserEntryBase* b)
{
return *b < *a;
}
),
(ThumbBrowserEntryBase*)entry
);
initEntry (entry);
}