Commit Graph

4 Commits

Author SHA1 Message Date
Jarek Kobus
29811f81dc FileSearch: Introduce FileContainer
That's going to replace FileIterator.

Benefits over FileIterator:

1. The FileContainer is a value type which may be
   freely copied.
2. Much faster iterating, especially for SubDirFileContainer
   with a big number of dirs / files (over 500000).

The FileContainer has begin() and end() functions returning
FileContainerIterator. The FileContainerIterator, when it's
not an end() iterator, contains the Item's value itself.
Whenever the iterator advances, the Item's value changes,
while the reference to Item's value remains unchanged inside
the iterator.

The SubDirFileContainer doesn't keep the references to all
visited Items anymore, contrary to the corresponding
SubDirFileInterator. The values of the individually visited
Items are kept only inside FileContainerIterator instances.

The progress information is available through the
FileContainerIterator's progressValue() / progressMaximum().

Task-number: QTCREATORBUG-28892
Change-Id: If89ac1121c21fa2fb7355aa12438dce3e85e465d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-31 13:33:09 +00:00
Jarek Kobus
3a75af3794 tst_SubDirFileIterator: Always generate ~700000 files
And ~175000 directories.
Distribute the generation and cleanup on all available cores.

With this patch I get the following config / measurements (linux):

Generating on 24 cores...
Generating 698881 files...
Generating 174721 dirs...
Generating inside "/tmp/tst_manual_subdirfileiterator-eHVKTL" dir...
GENERATING TEMPORARY FILES TREE stopped with timeout: 1777ms

ITERATING with SubDirFileIterator stopped with timeout: 92744ms
ITERATING with manual iterator stopped with timeout: 7905ms
ITERATING with QDirIterator stopped with timeout: 4706ms

CLEANING UP stopped with timeout: 1969ms

Amends 686a40d199

Change-Id: I7838e9cf73eae731a4dc3be02eeefa5caae8613d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-31 13:32:59 +00:00
Jarek Kobus
2274847bfe tst_SubDirFileIterator: Fix build with Qt < 6.3
QDirIterator::nextFileInfo() was introduced in Qt 6.3.

Change-Id: I3ed6293d4262b0ff2bb4423eb37c35c7b3650e97
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 14:54:27 +00:00
Jarek Kobus
686a40d199 SubDirFileIterator: Add manual performance test
Compare the total time spent on iterating a big file tree
with 3 different time iterators:
- Utils::SubDirFileIterator
- manually written iterator using QDir::entryInfoList()
- QDirIterator

The iterator run through about one million files (including
about ~100K directories). The more files above this
number to be iterated over, the bigger the relative time
difference of SubDirFileIterator compared to other iterators.

The number of generated files depends on the running
machine's core number. In my case:

Number of cores: 24
Number of generated files: 898753
Number of generated directories: 112345
Time spent on generating file tree: ~2 seconds
Time spent on iterating using SubDirIterator: ~80 seconds
Time spent on iterating using manual iterator: ~8 seconds
Time spent on iterating using QDirIterator: ~4 seconds
Time spent on removing generated file tree: ~2 seconds

Task-number: QTCREATORBUG-28892
Change-Id: I94d7cf0169a470820dc27f39c9cdb4150eea51c1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-19 07:17:01 +00:00