diff options
Diffstat (limited to 'src/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml')
-rw-r--r-- | src/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml b/src/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml new file mode 100644 index 0000000..89cded0 --- /dev/null +++ b/src/benchmarks/auto/creation/quick.item/delegates_item_empty_jscreation.qml @@ -0,0 +1,34 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Test allocation of Item, with no Repeater or anything. +// Compare with delegates_qobject & delegates_item_empty. +Benchmark { + id: root; + count: 50; + staticCount: 5000; + + property var items; + onTChanged: { + allocate(); + } + + Component { + id: component; + 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(root); + items.push(object); + } + } +} |