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/benchmarks/qml') 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 From c6c0d730b7a88fa22f40d597183e91b73d9d165d Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 20 Apr 2016 13:39:58 +0200 Subject: QML: Remove internal field padding from QQuickAnchorPrivate. Don't store QQuickAnchorLine, but store both fields separately in QQuickAnchorPrivate. This prevents padding of QQuickAnchorLine, saving 48 bytes on x86_64 (or any platform where structs are 8-byte aligned). On x86_64, this also removes ~180 instructions for each QQuickAnchor creation/removal, and speeds up the constructor by 25%. While in the neighborhood, do a drive-by change and merge QQuickAnchorLine::AnchorLine and QQuickAnchors::Anchor by removing the former. Change-Id: I50ab6252b1903f5f1a075174e6185c3048a8f8ec Reviewed-by: Robin Burchell Reviewed-by: Shawn Rutledge --- tests/benchmarks/qml/creation/tst_creation.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/benchmarks/qml') diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp index e126cdae7e..7b00eabc28 100644 --- a/tests/benchmarks/qml/creation/tst_creation.cpp +++ b/tests/benchmarks/qml/creation/tst_creation.cpp @@ -68,6 +68,7 @@ private slots: void itemtests_qml_data(); void itemtests_qml(); + void anchors_creation(); void anchors_heightChange(); private: @@ -375,6 +376,20 @@ void tst_creation::itemtests_qml() QBENCHMARK { delete component.create(); } } +void tst_creation::anchors_creation() +{ + QQmlComponent component(&engine); + component.setData("import QtQuick 2.0\nItem { Item { anchors.bottom: parent.bottom } }", QUrl()); + + QObject *obj = component.create(); + delete obj; + + QBENCHMARK { + QObject *obj = component.create(); + delete obj; + } +} + void tst_creation::anchors_heightChange() { QQmlComponent component(&engine); -- cgit v1.2.3