From c71e40b2bdd1dd2f8f4049f3ab2da1446518b9e8 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 20 Apr 2016 13:23:29 +0200 Subject: QML: Access QQuickItemPrivate data (like x/y/etc) directly. This saves ~5% in QQuickAnchorsPrivate::itemGeometryChanged on x86_64. Change-Id: Iccf782521e9c8523c41c6f2e6d87fad401762a9e Reviewed-by: Michael Brasser --- tests/benchmarks/qml/creation/tst_creation.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp index cda2542339..4b985d00f1 100644 --- a/tests/benchmarks/qml/creation/tst_creation.cpp +++ b/tests/benchmarks/qml/creation/tst_creation.cpp @@ -73,6 +73,8 @@ private slots: void itemtests_qml_data(); void itemtests_qml(); + void anchors_heightChange(); + private: QQmlEngine engine; }; @@ -378,6 +380,24 @@ void tst_creation::itemtests_qml() QBENCHMARK { delete component.create(); } } +void tst_creation::anchors_heightChange() +{ + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nItem { Item { anchors.bottom: parent.bottom } }", QUrl()); + + QObject *obj = component.create(); + auto item = qobject_cast(obj); + Q_ASSERT(item); + int height = 1; + + QBENCHMARK { + item->setHeight(height); + height += 1; + } + + delete obj; +} + QTEST_MAIN(tst_creation) #include "tst_creation.moc" -- cgit v1.2.3