FileCatalog::reparseDirectory(): speedup
This commit is contained in:
parent
55f6b1ad1e
commit
72ae120bd1
@ -37,6 +37,9 @@
|
|||||||
#include "batchqueue.h"
|
#include "batchqueue.h"
|
||||||
#include "placesbrowser.h"
|
#include "placesbrowser.h"
|
||||||
|
|
||||||
|
#define BENCHMARK
|
||||||
|
#include "../rtengine/StopWatch.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define CHECKTIME 2000
|
#define CHECKTIME 2000
|
||||||
@ -1672,7 +1675,7 @@ void FileCatalog::filterChanged ()
|
|||||||
|
|
||||||
void FileCatalog::reparseDirectory ()
|
void FileCatalog::reparseDirectory ()
|
||||||
{
|
{
|
||||||
|
BENCHFUN
|
||||||
if (selectedDirectory.empty()) {
|
if (selectedDirectory.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1704,17 +1707,15 @@ void FileCatalog::reparseDirectory ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if a new file has been added
|
// check if a new file has been added
|
||||||
for (size_t i = 0; i < nfileNameList.size(); i++) {
|
// build a set of collate-keys for faster search
|
||||||
bool found = false;
|
std::set<std::string> oldNames;
|
||||||
|
for (size_t j = 0; j < fileNameList.size(); j++) {
|
||||||
for (size_t j = 0; j < fileNameList.size(); j++)
|
oldNames.insert(fileNameList[j].collate_key());
|
||||||
if (nfileNameList[i] == fileNameList[j]) {
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
for (size_t i = 0; i < nfileNameList.size(); i++) {
|
||||||
checkAndAddFile (Gio::File::create_for_parse_name (nfileNameList[i]));
|
if (oldNames.count(nfileNameList[i].collate_key()) == 0) {
|
||||||
|
checkAndAddFile (Gio::File::create_for_parse_name(nfileNameList[i]));
|
||||||
_refreshProgressBar ();
|
_refreshProgressBar ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user