aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-03-24 12:24:17 +0100
committerRobin Burchell <robin.burchell@crimson.no>2017-03-24 14:43:35 +0000
commit4fddd478d8525330fed99300a094d0468cd7131d (patch)
treeca3966dc16b87ac5a14a6df708755ec88c0ddc64 /benchmarks
parentb6e805801cc60d6de99bbae3e5b28ec96a679596 (diff)
Add a base Benchmark and CreationBenchmark type
These will allow us to make benchmarks more succinct without adding too much complexity. Change-Id: I5b38dfc388d1d56780eb107d36060d3e1c23cdea Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/auto/creation/quick/delegates_item.qml32
-rw-r--r--benchmarks/auto/creation/quick/delegates_item_empty.qml24
-rw-r--r--benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml10
3 files changed, 21 insertions, 45 deletions
diff --git a/benchmarks/auto/creation/quick/delegates_item.qml b/benchmarks/auto/creation/quick/delegates_item.qml
index 944fe9e..7e56d6a 100644
--- a/benchmarks/auto/creation/quick/delegates_item.qml
+++ b/benchmarks/auto/creation/quick/delegates_item.qml
@@ -1,26 +1,16 @@
import QtQuick 2.0
+import QmlBench 1.0
-Item {
+// Tests the creation of Item with a few simple props.
+// Compare with delegates_item_empty, and delegates_item_empty_jscreation.
+CreationBenchmark {
id: root;
- property int count: 50;
- property int staticCount: 5000;
-
- 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
- }
+ count: 50
+ staticCount: 5000
+ delegate: Item {
+ x: Math.random() * (root.width - width)
+ y: Math.random() * (root.height - height)
+ width: 30
+ height: 15
}
}
diff --git a/benchmarks/auto/creation/quick/delegates_item_empty.qml b/benchmarks/auto/creation/quick/delegates_item_empty.qml
index f8d8607..17d038b 100644
--- a/benchmarks/auto/creation/quick/delegates_item_empty.qml
+++ b/benchmarks/auto/creation/quick/delegates_item_empty.qml
@@ -1,22 +1,10 @@
import QtQuick 2.0
+import QmlBench 1.0
-Item {
- id: root;
- property int count: 50;
- property int staticCount: 5000;
-
- 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 {
- }
+CreationBenchmark {
+ id: root
+ count: 50;
+ staticCount: 5000;
+ delegate: Item {
}
}
diff --git a/benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml b/benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml
index 0afa7ee..347be4d 100644
--- a/benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml
+++ b/benchmarks/auto/creation/quick/delegates_item_empty_jscreation.qml
@@ -1,13 +1,12 @@
import QtQuick 2.0
+import QmlBench 1.0
-Item {
+Benchmark {
id: root;
- property int count: 50;
- property int staticCount: 5000;
+ count: 50;
+ staticCount: 5000;
property var items;
- property real t;
- NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite }
onTChanged: {
allocate();
}
@@ -19,7 +18,6 @@ Item {
}
function allocate() {
-
if (items && items.length) {
for (var i=0; i<items.length; ++i)
items[i].destroy();