Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.1.0
-
None
Description
With latest stable (53ac80c50c0711d39ee4e6f41eb7427891670d60) sorting a QFileSystemModel is extremely slow.
Steps to reproduce:
- create a directory with a huge number of files (say 10000, f.i. with apg -a 1 -n 10000 -m 20 -x 20 -M nc | xargs touch)
- point this example to it
#include <QtWidgets> int main(int argc, char **argv) { QApplication app(argc, argv); QDir dir("/"); QFileSystemModel model; QModelIndex index = model.setRootPath(dir.path()); model.setFilter(QDir::AllDirs | QDir::AllEntries | QDir::Hidden | QDir::System); QTreeView view; view.setModel(&model); view.setRootIndex(index); view.setSortingEnabled(true); view.show(); return app.exec(); }
It will take several seconds in order to produce a sort.
callgrind shows several huge hitters:
- 20% spent in addLikelySubtags(QLocaleId &localeId)
- 18% spent in an insane number of calls to QLocaleId::operator== (~860 million calls), called from addLikelySubtags
- ~16% spent inside ICU
etc.
Profiled target: ./filesystemmodel (PID 2899, part 1) Events recorded: Ir Events shown: Ir Event sort order: Ir Thresholds: 99 Include dirs: User annotated: Auto-annotation: off -------------------------------------------------------------------------------- Ir -------------------------------------------------------------------------------- 55,435,215,851 PROGRAM TOTALS -------------------------------------------------------------------------------- Ir file:function -------------------------------------------------------------------------------- 11,224,356,786 /home/peppe/p/qtbase/src/corelib/tools/qlocale.cpp:addLikelySubtags(QLocaleId&) [/home/peppe/b/qtbase/lib/libQt5Core.so.5.1.0] 10,351,476,790 /home/peppe/p/qtbase/src/corelib/tools/qlocale_p.h:QLocaleId::operator==(QLocaleId) const [/home/peppe/b/qtbase/lib/libQt5Core.so.5.1.0] 9,263,507,708 ???:0x00000000000dc830 [/usr/lib/libicui18n.so.48.1.1] 2,855,946,156 ???:ucol_getNextCE_48 [/usr/lib/libicui18n.so.48.1.1] 2,652,721,254 ???:0x00000000000d1a60 [/usr/lib/libicui18n.so.48.1.1] 1,451,495,035 /build/buildd/eglibc-2.15/malloc/malloc.c:_int_malloc [/lib/x86_64-linux-gnu/libc-2.15.so] 1,357,403,520 ???:ucol_next_48 [/usr/lib/libicui18n.so.48.1.1] 1,141,452,960 ???:uprv_init_collIterate_48 [/usr/lib/libicui18n.so.48.1.1] 1,126,027,920 ???:ucol_setText_48 [/usr/lib/libicui18n.so.48.1.1] 714,871,351 /build/buildd/eglibc-2.15/malloc/malloc.c:_int_free [/lib/x86_64-linux-gnu/libc-2.15.so] 627,799,128 ???:icu_48::Normalizer2Factory::getNFDInstance(UErrorCode&) [/usr/lib/libicuuc.so.48.1.1] 456,581,228 ???:0x00000000000f57d0 [/usr/lib/libicuuc.so.48.1.1] 401,822,292 ???:0x00000000000dd740 [/usr/lib/libicui18n.so.48.1.1] 390,687,321 /build/buildd/eglibc-2.15/malloc/malloc.c:malloc [/lib/x86_64-linux-gnu/libc-2.15.so] ...
Attachments
Issue Links
- is duplicated by
-
QTBUG-41373 QFileDialog extermely slow and non-reactive with large number of files
- Closed
- resulted in
-
QTBUG-52561 [REG 5.5->5.6] The renamed item's information is not available in handler of QFileSystemModel::fileRenamed()
- Closed