aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-05-03 13:52:47 +0200
committerRobin Burchell <robin.burchell@crimson.no>2017-05-04 11:47:35 +0000
commit45da7843d6c7b70ecd37c952fd68dd84f79c23e0 (patch)
tree2a7b8354ff5d2aa343f569cfea8fdb1219dd3636
parente0691db16e4fb8410fd3728197a70d83250428c5 (diff)
Make delegates_item_empty_jscreation & delegates_qobject comparable
In delegates_qobject, we now use a JS array to store items in before deletion. This should make it a bit more heavy/slower. In delegates_item_empty_jscreation, we remove the redundant parenting (via 'root'), and just use the JS array. This should make it a bit lighter/faster. With these changes together, one can meaningfully get a bit of an idea of the raw impact of allocating QQuickItem vs QObject. Change-Id: I503a205760ff767b6ca8d42a2989755facaacb12 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
-rw-r--r--benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml2
-rw-r--r--benchmarks/auto/creation/quick/delegates_qobject.qml9
2 files changed, 9 insertions, 2 deletions
diff --git a/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml b/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml
index 89cded0..920b4c8 100644
--- a/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml
+++ b/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml
@@ -27,7 +27,7 @@ Benchmark {
items = [];
for (var i=0; i<root.count; ++i) {
- var object = component.createObject(root);
+ var object = component.createObject();
items.push(object);
}
}
diff --git a/benchmarks/auto/creation/quick/delegates_qobject.qml b/benchmarks/auto/creation/quick/delegates_qobject.qml
index 130d722..ee9bc3d 100644
--- a/benchmarks/auto/creation/quick/delegates_qobject.qml
+++ b/benchmarks/auto/creation/quick/delegates_qobject.qml
@@ -8,6 +8,7 @@ Benchmark {
count: 50;
staticCount: 10000;
+ property var items;
onTChanged: {
allocate();
}
@@ -19,9 +20,15 @@ Benchmark {
}
function allocate() {
+ if (items && items.length) {
+ for (var i=0; i<items.length; ++i)
+ items[i].destroy();
+ }
+ items = [];
+
for (var i=0; i<root.count; ++i) {
var object = component.createObject();
- object.destroy();
+ items.push(object);
}
}
}