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

Huge performance loss in Qt 5 when locale-aware sorting a QStringList

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.3.0 RC1
    • Component/s: Core: Locales (i18n)
    • Labels:
      None
    • Environment:
      Callgrind points to QCollator. See attached main.cpp.

      Description

      In Qt 4 when I inserted some (20 000+) rows into a QTreeWidget or QTableWidget and enabled sorting, it never took more than a second to display that amount of data.

      Now, on Qt 5 the very same code executes in 10 seconds on a Core i7.

      I attach a sample code (qmake && make) which contains a random string list which gets loaded into a QTreeWidget. Then gets sorted.

      In Qt 4.8.1 I get the following output:
      Textfile read in 12 ms
      Items inserted into the table in 1105 ms
      Items sorted in 303 ms

      In Qt 5.2:
      Textfile read in 6 ms
      Items inserted into the table in 58 ms
      Items sorted in 9169 ms

      This is a huge performance decline.

        Attachments

        1. main.cpp
          1.0 kB
        2. qt-sorting-bug.tar.xz
          591 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            laknoll Lars Knoll
            Reporter:
            szotsaki Szőts Ákos
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes