Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
None
-
5.13.1
-
None
Description
Dear Qt development community,
when calling the QFileDialog::getOpenFileName static function for the first time I experience huge load on my I/O as well as CPU. Upon closer examination I realized that Qt is sys-calling the filesystem a whopping ~20k times! Log is present in the attachments. This is very strange because many of these calls are checking icon files that do not exist.
I have attached the full log of QAbstractFileEngine creation by Qt. Starting from about line 193 I have made the call to QFileDialog::getOpenFileName. The issues does not happen on Windows neither on native Linux with full GUI installation.
The callstack of a typical icon fscall is here:
#0 ?? FileSystemQtFileEngine::fileFlags (this=0x7ffff9a6e2e0, type=...) (/mnt/y/DEVEL/magic-txd/src/qtfilesystem.cpp:633)
#1 0x8e8ec43 QFileInfoPrivate::getFileFlags(QFlags<QAbstractFileEngine::FileFlag>) const () (:)
#2 0x8e91db3 QFileInfo::exists(QString const&) () (:)
#3 0x8b320a6 QIconLoader::findIconHelper(QString const&, QString const&, QStringList&) const () (:)
#4 0x8b33413 QIconLoader::loadIcon(QString const&) const () (:)
#5 0x8b336a4 QIconLoaderEngine::ensureLoaded() [clone .part.0] () (:)
#6 0x8b3441b QIconLoaderEngine::virtual_hook(int, void*) () (:)
#7 0x8b3499c QIconEngine::isNull() const () (:)
#8 0x88ac2e8 QCommonStyle::standardIcon(QStyle::StandardPixmap, QStyleOption const*, QWidget const*) const () (:)
#9 0x8676825 QFusionStyle::standardIcon(QStyle::StandardPixmap, QStyleOption const*, QWidget const*) const () (:)
#10 0x864947f QStyleSheetStyle::standardIcon(QStyle::StandardPixmap, QStyleOption const*, QWidget const*) const () (:)
#11 0x87f3f8d QFileIconProviderPrivate::getIcon(QStyle::StandardPixmap) const () (:)
#12 0x87f440c QFileIconProvider::icon(QFileInfo const&) const () (:)
#13 0x87675ab QFileInfoGatherer::getInfo(QFileInfo const&) const () (:)
#14 0x875dcaa QFileSystemModelPrivate::node(QString const&, bool) const () (:)
#15 0x875e373 ) const () (:)
#16 0x8758315 QUrlModel::addUrls(QList<QUrl> const&, int, bool) () (:)
#17 0x8758703 QUrlModel::setUrls(QList<QUrl> const&) () (:)
#18 0x8758987 QSidebar::setModelAndUrls(QFileSystemModel*, QList<QUrl> const&) () (:)
#19 0x8750b7d QFileDialogPrivate::createWidgets() [clone .part.0] () (:)
#20 0x87523c8 QFileDialogPrivate::init(QUrl const&, QString const&, QString const&) () (:)
#21 0x8752b52 QFileDialog::QFileDialog(QFileDialogArgs const&) () (:)
#22 0x8752cba QFileDialog::getOpenFileUrl(QWidget*, QString const&, QUrl const&, QString const&, QString*, QFlags<QFileDialog::Option>, QStringList const&) () (:)
#23 0x8752fb4 QFileDialog::getOpenFileName(QWidget*, QString const&, QString const&, QString const&, QString*, QFlags<QFileDialog::Option>) () (:)
#24 0x818b1a8 MainWindow::<lambda()>::operator()(void) const(__closure=0x7ffffffed3b0) (/mnt/y/DEVEL/magic-txd/src/mainwindow.cpp:1484)
The issue does not appear when building the GTK icon cache. Then Qt does use the mmapable file to find all icons (for some reason fails on WSL).
Is there any hope that the Qt implementation of the icon loader could improve it's performance? How about using QAbstractFileEngine::entryList semantics for loading all required icons, instead of peeking and poking?
Qt5.13.1 has been built statically under Ubuntu 19.04 with GTK-3 present. The build script has been attached (please do not mind my language in it).