diff options
Diffstat (limited to 'src/benchmarks/auto/creation/quick/delegates_qobject_large_array.qml')
-rw-r--r-- | src/benchmarks/auto/creation/quick/delegates_qobject_large_array.qml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/benchmarks/auto/creation/quick/delegates_qobject_large_array.qml b/src/benchmarks/auto/creation/quick/delegates_qobject_large_array.qml new file mode 100644 index 0000000..01fc3cf --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_qobject_large_array.qml @@ -0,0 +1,36 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Test allocation of QObject, with no Repeater or anything, stored in a JS +// array. The array is interesting as it's a large GC'd allocation. +// Compare with delegates_qobject. +Benchmark { + id: root; + count: 50; + staticCount: 10000; + + property var items; + onTChanged: { + allocate(); + } + + Component { + id: component; + QtObject { + } + } + + 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(); + items.push(object); + } + } +} + |