aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@theqtcompany.com>2016-04-20 13:23:29 +0200
committerErik Verbruggen <erik.verbruggen@qt.io>2016-04-21 15:04:36 +0000
commitc71e40b2bdd1dd2f8f4049f3ab2da1446518b9e8 (patch)
tree2645df8fecdc7ec74b8207dbd6095370e706a5f9 /tests
parent3b9d7ee10e2ae6565f0767219303d9a11d80f489 (diff)
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 <michael.brasser@live.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp20
1 files changed, 20 insertions, 0 deletions
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<QQuickItem *>(obj);
+ Q_ASSERT(item);
+ int height = 1;
+
+ QBENCHMARK {
+ item->setHeight(height);
+ height += 1;
+ }
+
+ delete obj;
+}
+
QTEST_MAIN(tst_creation)
#include "tst_creation.moc"