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); MYWRITERLOCK(l, entryRW);
std::vector<ThumbBrowserEntryBase*>::iterator i = fd.begin(); fd.insert(
std::lower_bound(
while (i != fd.end() && *entry < * ((FileBrowserEntry*)*i)) { fd.begin(),
++i; fd.end(),
} (ThumbBrowserEntryBase*)entry,
[](ThumbBrowserEntryBase* a, ThumbBrowserEntryBase* b)
fd.insert (i, entry); {
return *b < *a;
}
),
(ThumbBrowserEntryBase*)entry
);
initEntry (entry); initEntry (entry);
} }