Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-95383

QFileSystemModel sort extremely inefficient with wildcards

    XMLWordPrintable

Details

    • All
    • 07057188e3e42246cf006b43963d0bdcdaa159f5 (qt/qtbase/dev) 91db96f3366cb5ebe5846ac69b593acc4830d2c9 (qt/qtbase/6.2) bc904c8524d9d230de3b634024548d3abdbca843 (qt/qtbase/6.1)

    Description

      Hello,

      Consider the function

      bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) const
      

      which is called for every child in sortChildren:

      https://github.com/qt/qtbase/blob/dev/src/gui/itemmodels/qfilesystemmodel.cpp#L2158

      It will call most of the time

      bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const
      

      which, for every wildcard name filter given to the model, constructs a QRegularExpression, and compiles it !

      https://github.com/qt/qtbase/blob/dev/src/gui/itemmodels/qfilesystemmodel.cpp#L2158

      In my use case I have a fair amount of wildcards, coming from plug-ins to my software which make some file extensions visible or not in a QFSModel. When sorting a hundred files, this blocks the software for 4/5 seconds every time.

      Attachments

        Activity

          People

            peppe Giuseppe D'Angelo
            jcelerier Jean-Michaël Celerier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: