Details
-
Sub-task
-
Resolution: Unresolved
-
P1: Critical
-
None
-
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