aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@sletta.org>2016-05-06 07:28:35 +0100
committerGunnar Sletta <gunnar@sletta.org>2016-05-06 07:28:35 +0100
commit93223d3a1f5b88810add43d1b4f5661c8009ea6a (patch)
treee77673bab489386efd80343eab14631dd4cc7d44
parent5dcc804ead9717dedc4a18d82ea4b25dfa557170 (diff)
Retain the items between iterations in the the empty js creation test
-rw-r--r--benchmark/creation/delegates_item_empty_jscreation.qml12
1 files changed, 10 insertions, 2 deletions
diff --git a/benchmark/creation/delegates_item_empty_jscreation.qml b/benchmark/creation/delegates_item_empty_jscreation.qml
index 6ab784a..36ce3a8 100644
--- a/benchmark/creation/delegates_item_empty_jscreation.qml
+++ b/benchmark/creation/delegates_item_empty_jscreation.qml
@@ -3,6 +3,7 @@ import QtQuick 2.0
Item {
id: root;
property int count: 50;
+ property var items;
property real t;
NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite }
@@ -17,9 +18,16 @@ Item {
}
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();
+ var object = component.createObject(root);
+ items.push(object);
}
}
}