Iterating with QDirIterator seems slow
I'm using QDirIterator to find all subdirectories based on a name filter like this:
Code:
nameFilters << "*CAL*";
QDirIterator dirIterator
(path, nameFilters,
QDir::Dirs, QDirIterator
::Subdirectories);
while (dirIterator.hasNext())
{
results << qstr;
}
The path value is a directory that in this case contains over 30,000 files and 1,100 subdirectories. The code returns the correct result, but it is slow (5 seconds or more). It is interesting that the QDirIterator constructor above returns almost immediately, but the next() call within the loop is what takes so long. Is there any reason why this operation would take this long? There are less than 10 directories out of 1,100 that match the name filter, but it takes a long time just to iterate through them.
Re: Iterating with QDirIterator seems slow
As a test, I ran the dos command:
dir *CAL* /AD /S /B
on the same directory and it was extremely fast in returning the desired result.
Is there any Qt class that can provide this result with similar performance? This is a difference of a fraction of a second versus several seconds.