diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-03-30 13:24:20 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-03-30 14:32:31 +0000 |
commit | ad736e2707026207ec4839f9141d407a820c01fe (patch) | |
tree | a871eaa3bd1979594adae2e75e1d9e8b1ebabe81 /benchmarks | |
parent | 7c3859a49ab5776d6df97858cef5b86688f8e1ce (diff) |
creation: Port remaining benchmarks to use benchmark helpers
Change-Id: I24ba380295eeb576d61ae28cc9db914b4522f39d
Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Diffstat (limited to 'benchmarks')
5 files changed, 47 insertions, 109 deletions
diff --git a/benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml b/benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml index 68626f2..cf32484 100644 --- a/benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml +++ b/benchmarks/auto/creation/controls/delegates_buttoncontrol2.qml @@ -1,26 +1,14 @@ import QtQuick 2.0 +import QmlBench 1.0 import QtQuick.Controls 2.0 -Item { +CreationBenchmark { id: root; - property int count: 20; - property int staticCount: 1000; - - property real t; - NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite } - onTChanged: { - repeater.model = 0; - repeater.model = root.count - } - - Component.onCompleted: repeater.model = root.count - - Repeater { - id: repeater - Button { - x: Math.random() * root.width - width - y: Math.random() * root.height - height - text: "Item #" + index; - } + count: 20; + staticCount: 1000; + delegate: Button { + x: Math.random() * root.width - width + y: Math.random() * root.height - height + text: "Item #" + index; } } diff --git a/benchmarks/auto/creation/controls/delegates_labelcontrol2.qml b/benchmarks/auto/creation/controls/delegates_labelcontrol2.qml index fbde27e..4ab8401 100644 --- a/benchmarks/auto/creation/controls/delegates_labelcontrol2.qml +++ b/benchmarks/auto/creation/controls/delegates_labelcontrol2.qml @@ -1,26 +1,14 @@ import QtQuick 2.0 +import QmlBench 1.0 import QtQuick.Controls 2.0 -Item { +CreationBenchmark { id: root; - property int count: 20; - property int staticCount: 1000; - - property real t; - NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite } - onTChanged: { - repeater.model = 0; - repeater.model = root.count - } - - Component.onCompleted: repeater.model = root.count - - Repeater { - id: repeater - Label { - x: Math.random() * root.width - width - y: Math.random() * root.height - height - text: "Qt Quick!" - } + count: 20; + staticCount: 1000; + delegate: Label { + x: Math.random() * root.width - width + y: Math.random() * root.height - height + text: "Qt Quick!" } } diff --git a/benchmarks/auto/creation/quick.image/delegates_image.qml b/benchmarks/auto/creation/quick.image/delegates_image.qml index d01ffe2..ddc2ae9 100644 --- a/benchmarks/auto/creation/quick.image/delegates_image.qml +++ b/benchmarks/auto/creation/quick.image/delegates_image.qml @@ -1,18 +1,10 @@ import QtQuick 2.0 +import QmlBench 1.0 -Item { +CreationBenchmark { id: root; - property int count: 50; - property int staticCount: 2500; - - property real t; - NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite } - onTChanged: { - repeater.model = 0; - repeater.model = root.count - } - - Component.onCompleted: repeater.model = root.count + count: 50; + staticCount: 2500; property var names: [ "butterfly-wide.png", @@ -20,15 +12,11 @@ Item { "butterfly-collapsed.png" ]; - Repeater { - id: repeater - Image { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) - source: "../../../../shared/" + root.names[index % 3]; - width: 20 - height: 20 - - } + delegate: Image { + x: Math.random() * (root.width - width) + y: Math.random() * (root.height - height) + source: "../../../../shared/" + root.names[index % 3]; + width: 20 + height: 20 } } diff --git a/benchmarks/auto/creation/quick.item/item_anchors.qml b/benchmarks/auto/creation/quick.item/item_anchors.qml index 7b9fc4c..3d6cddd 100644 --- a/benchmarks/auto/creation/quick.item/item_anchors.qml +++ b/benchmarks/auto/creation/quick.item/item_anchors.qml @@ -1,32 +1,19 @@ import QtQuick 2.0 +import QmlBench 1.0 // Testing the performance of anchors against w/h bindings (item_size). -Item { +CreationBenchmark { id: root; - property int count: 50; - property int staticCount: 2500; + count: 50; + staticCount: 2500; + delegate: Item { + x: Math.random() * (root.width - width) + y: Math.random() * (root.height - height) + width: 30 + height: 15 - property real t; - NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite } - onTChanged: { - repeater.model = 0; - repeater.model = root.count - } - - Component.onCompleted: repeater.model = root.count - - Repeater { - id: repeater Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) - width: 30 - height: 15 - - Item { - anchors.fill: parent - } + anchors.fill: parent } } } - diff --git a/benchmarks/auto/creation/quick.item/item_size.qml b/benchmarks/auto/creation/quick.item/item_size.qml index 47ddd76..1c6da93 100644 --- a/benchmarks/auto/creation/quick.item/item_size.qml +++ b/benchmarks/auto/creation/quick.item/item_size.qml @@ -1,34 +1,21 @@ import QtQuick 2.0 +import QmlBench 1.0 // Testing the performance of w/h bindings against anchors (item_anchors). -Item { +CreationBenchmark { id: root; - property int count: 50; - property int staticCount: 2500; + count: 50; + staticCount: 2500; + delegate: Item { + x: Math.random() * (root.width - width) + y: Math.random() * (root.height - height) + width: 30 + height: 15 - property real t; - NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite } - onTChanged: { - repeater.model = 0; - repeater.model = root.count - } - - Component.onCompleted: repeater.model = root.count - - Repeater { - id: repeater Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) - width: 30 - height: 15 - - Item { - width: parent.width - height: parent.height - } + width: parent.width + height: parent.height } } } - |