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

QTreeView low performance with high uncollapsed row count

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.9, 5.15.5, 6.x
    • Fix Version/s: None
    • Component/s: Widgets: Itemviews
    • Labels:
      None
    • Platform/s:
      All

      Description

      The current implementation of QTreeViewPrivate::viewIndex() yields bad performance if a high number of rows is not collapsed ( = QTreeViewPrivate::viewItems is huge, as in "several thousand rows"), as this results in a linear scan of all rows.

      With QTreeViewPrivate::lastViewedItem being also updated by that function (some weird attempt at using locality?), any non-trivial access pattern never hits the "fast paths" encoded in the heuristics of that method.

      With QTreeViewPrivate::viewIndex() being treated as "for free" in the remainder of this class, this makes up for up to 90% of the CPU time in all of QTreeView for pure model-driven data-updates.

      QTreeViewPrivate::layout() should be extended to build the index QHash<QIndex, int> from "primary column index" (const QModelIndex index = _index.sibling(_index.row(), 0); in QTreeViewPrivate::viewIndex(), current in QTreeViewPrivate::layout()) to offset in viewItem alongside with viewItem itself, so that the lookup can be performed in constant time. The index must be cleared when clearing QTreeViewPrivate::viewItems.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            ext3h Andreas Ringlstetter
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes