Cache module details (plugin path, components, etc) for each
processed module.
Cache recursive dependency module details for each processed
module.
Skip self dependencies.
Discard duplicates when merging module details.
Use a custom hasher object to store QVariantMaps in
std::unordered_set / std::unordered_map because QVariant does not
provide a qHash overload.
With the improvements above, for a project that has 100 qml files,
each importing QtQuick.Controls and QtQuick as many times
as the file index (file 100 imports QtQuick and Controls 100 times),
the execution time is reduced ~7x times.
Before 1.52s user 0.22s system 99% cpu 1.741 total
After 0.22s user 0.03s system 97% cpu 0.248 total
For the examples/quickcontrols2/gallery project, the stats are
Before 0.81s user 0.13s system 96% cpu 0.968 total debug
After 0.17s user 0.03s system 75% cpu 0.266 total debug
Before 0.15s user 0.09s system 95% cpu 0.251 total release
After 0.05s user 0.03s system 54% cpu 0.138 total release
That's a ~5x improvement for a debug build of qmlimportscanner
and a ~3x improvement for a release build of qmlimportscanner.
Benched on a 16" Intel macbook pro 2019 with a USB SSD.
Pick-to: 6.2 6.3
Fixes: QTBUG-103187
Change-Id: I730d762ff99b52918568fdf119eb68201a7d6c4a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>