Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-129586 [Reg 6.7.0 -> 6.7.1] Slowness of some languages / changing languages
  3. QTBUG-129741

[Reg 6.7.0 -> 6.7.1] Performance regression in layout invalidation

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Unresolved
    • P1: Critical
    • None
    • Quick: Layouts
    • None

    Description

      This issue results from https://bugreports.qt.io/browse/QTBUG-129586 

      Its original description describes two issues and provides a reproducer.

      One of the issues is the increase in time for the toggle function to run.

       

      QVersionNumber(6.7.0): 450ms
      QVersionNumber(6.7.0): 354ms
      QVersionNumber(6.7.0): 431ms
      QVersionNumber(6.7.0): 348ms
      QVersionNumber(6.7.1): 1241ms
      QVersionNumber(6.7.1): 1481ms
      QVersionNumber(6.7.1): 1702ms
      QVersionNumber(6.7.1): 1590ms
      

       

      After adding timing code and bisecting, I narrowed the regression down to https://codereview.qt-project.org/c/qt/qtdeclarative/+/531146 

      It seems that the logic for invalidating the layout can have quadratic complexity. This was either exposed or made worse by the linked change.

      Adding the following lines to void QQuickGridLayoutBase::invalidate(QQuickItem *childItem) shows the that the a linear scan over all 20000 elements is performed for each of those elements.

       

              static int i = 0;
              qDebug() << "iteration" << ++i;
              qDebug() << "linear scan over" << d->engine.itemCount() << "items";
              if (QQuickGridLayoutItem *layoutItem = d->engine.findLayoutItem(childItem)) {
                  layoutItem->invalidate();
              } 
      ...
      iteration 39996
      linear scan over 20000 items
      iteration 39997
      linear scan over 20000 items
      iteration 39998
      linear scan over 20000 items
      iteration 39999
      linear scan over 20000 items
      iteration 40000
      linear scan over 20000 items
      QVersionNumber(6.7.1): 4929ms 

       

      Attachments

        1. timed_reproducer.tar.gz
          2 kB
          Olivier De Cannière
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            olivier.decanniere Olivier De Cannière
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes