diff options
Diffstat (limited to 'src/benchmarks/auto/creation/quick')
21 files changed, 396 insertions, 0 deletions
diff --git a/src/benchmarks/auto/creation/quick/compile.bat b/src/benchmarks/auto/creation/quick/compile.bat new file mode 100644 index 0000000..e0eeb95 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/compile.bat @@ -0,0 +1 @@ +qsb --glsl "100 es,120,150" --hlsl 50 --msl 12 -o red.frag.qsb red.frag diff --git a/src/benchmarks/auto/creation/quick/delegates_flickable.qml b/src/benchmarks/auto/creation/quick/delegates_flickable.qml new file mode 100644 index 0000000..303570e --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_flickable.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of Flickable with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: Flickable { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} diff --git a/src/benchmarks/auto/creation/quick/delegates_flipable.qml b/src/benchmarks/auto/creation/quick/delegates_flipable.qml new file mode 100644 index 0000000..15a29b3 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_flipable.qml @@ -0,0 +1,15 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of Flipable with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: Flipable { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} diff --git a/src/benchmarks/auto/creation/quick/delegates_focusscope.qml b/src/benchmarks/auto/creation/quick/delegates_focusscope.qml new file mode 100644 index 0000000..059ae2f --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_focusscope.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of FocusScope with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: FocusScope { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} + diff --git a/src/benchmarks/auto/creation/quick/delegates_fontloader.qml b/src/benchmarks/auto/creation/quick/delegates_fontloader.qml new file mode 100644 index 0000000..354552b --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_fontloader.qml @@ -0,0 +1,27 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of FontLoader with some simple props +// ### add a test for FontLoader from TTF? +CreationBenchmark { + id: root; + count: 50; + staticCount: 2500; + + property string fontName: { + if (Qt.platform.os == "osx") { + return "Helvetica" + } else if (Qt.platform.os == "linux") { + return "Open Sans" + } else if (Qt.platform.os == "windows") { + return "Arial" + } + } + + delegate: Item { + FontLoader { + name: root.fontName + } + } +} + diff --git a/src/benchmarks/auto/creation/quick/delegates_fontmetrics.qml b/src/benchmarks/auto/creation/quick/delegates_fontmetrics.qml new file mode 100644 index 0000000..849dc0b --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_fontmetrics.qml @@ -0,0 +1,27 @@ +import QtQuick 2.4 +import QmlBench 1.0 + +// Tests the creation of FontMetrics with some simple props +CreationBenchmark { + id: root; + count: 50; + staticCount: 2500; + + property string fontName: { + if (Qt.platform.os == "osx") { + return "Helvetica" + } else if (Qt.platform.os == "linux") { + return "Open Sans" + } else if (Qt.platform.os == "windows") { + return "Arial" + } + } + + delegate: Item { + FontMetrics { + font.family: root.fontName + } + } +} + + diff --git a/src/benchmarks/auto/creation/quick/delegates_gridview.qml b/src/benchmarks/auto/creation/quick/delegates_gridview.qml new file mode 100644 index 0000000..386d865 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_gridview.qml @@ -0,0 +1,16 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of GridView with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: GridView { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} + diff --git a/src/benchmarks/auto/creation/quick/delegates_listview.qml b/src/benchmarks/auto/creation/quick/delegates_listview.qml new file mode 100644 index 0000000..413bbb2 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_listview.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of ListView with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: ListView { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} + + diff --git a/src/benchmarks/auto/creation/quick/delegates_loader.qml b/src/benchmarks/auto/creation/quick/delegates_loader.qml new file mode 100644 index 0000000..7271f15 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_loader.qml @@ -0,0 +1,23 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of Loader with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: Loader { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + sourceComponent: anItemComponent + } + + Component { + id: anItemComponent + Item { + } + } +} + diff --git a/src/benchmarks/auto/creation/quick/delegates_mousearea.qml b/src/benchmarks/auto/creation/quick/delegates_mousearea.qml new file mode 100644 index 0000000..eaf3ad0 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_mousearea.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of MouseArea with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: MouseArea { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + hoverEnabled: true + width: 30 + height: 15 + } +} + diff --git a/src/benchmarks/auto/creation/quick/delegates_multipointtoucharea.qml b/src/benchmarks/auto/creation/quick/delegates_multipointtoucharea.qml new file mode 100644 index 0000000..68b4976 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_multipointtoucharea.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of MultiPointTouchArea with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: MultiPointTouchArea { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} + + diff --git a/src/benchmarks/auto/creation/quick/delegates_pathview.qml b/src/benchmarks/auto/creation/quick/delegates_pathview.qml new file mode 100644 index 0000000..f370e3b --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_pathview.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of PathView with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: PathView { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} + + + diff --git a/src/benchmarks/auto/creation/quick/delegates_pincharea.qml b/src/benchmarks/auto/creation/quick/delegates_pincharea.qml new file mode 100644 index 0000000..b89efc6 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_pincharea.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of PinchArea with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 2500 + delegate: PinchArea { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + } +} + + + + diff --git a/src/benchmarks/auto/creation/quick/delegates_qobject.qml b/src/benchmarks/auto/creation/quick/delegates_qobject.qml new file mode 100644 index 0000000..2bd8d52 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_qobject.qml @@ -0,0 +1,27 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Test allocation of QObject, with no Repeater or anything. +// Compare with delegates_qobject. +Benchmark { + id: root; + count: 50; + staticCount: 10000; + + onTChanged: { + allocate(); + } + + Component { + id: component; + QtObject { + } + } + + function allocate() { + for (var i=0; i<root.count; ++i) { + var object = component.createObject(); + object.destroy(); + } + } +} 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); + } + } +} + diff --git a/src/benchmarks/auto/creation/quick/delegates_shadereffect.qml b/src/benchmarks/auto/creation/quick/delegates_shadereffect.qml new file mode 100644 index 0000000..b81ba5c --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_shadereffect.qml @@ -0,0 +1,18 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of ShaderEffect +CreationBenchmark { + id: root; + count: 50; + staticCount: 2500; + delegate: ShaderEffect { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + fragmentShader: "red.frag.qsb" + } +} + + diff --git a/src/benchmarks/auto/creation/quick/delegates_shadereffect_props.qml b/src/benchmarks/auto/creation/quick/delegates_shadereffect_props.qml new file mode 100644 index 0000000..4aa855b --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_shadereffect_props.qml @@ -0,0 +1,26 @@ +import QtQuick 2.4 +import QmlBench 1.0 + +// Tests the creation of ShaderEffect with custom properties, +// as these add additional cost +CreationBenchmark { + id: root; + count: 50; + staticCount: 2500; + + Image { + id: sourceImage + source: "qrc:///shared/butterfly-wide.png" + } + + delegate: ShaderEffect { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: sourceImage.width + height: sourceImage.height + supportsAtlasTextures: true + property var source: sourceImage + } +} + + diff --git a/src/benchmarks/auto/creation/quick/delegates_shadereffectsource.qml b/src/benchmarks/auto/creation/quick/delegates_shadereffectsource.qml new file mode 100644 index 0000000..4e021a6 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_shadereffectsource.qml @@ -0,0 +1,24 @@ +import QtQuick 2.0 +import QmlBench 1.0 + +// Tests the creation of ShaderEffectSource with a few simple props. +CreationBenchmark { + id: root; + count: 50 + staticCount: 500 + delegate: ShaderEffectSource { + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) + width: 30 + height: 15 + sourceItem: sourceRectItem + } + + Rectangle { + id: sourceRectItem + color: "#ff0000" + width: 30 + height: 15 + } +} + diff --git a/src/benchmarks/auto/creation/quick/delegates_textmetrics.qml b/src/benchmarks/auto/creation/quick/delegates_textmetrics.qml new file mode 100644 index 0000000..33a9506 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/delegates_textmetrics.qml @@ -0,0 +1,29 @@ +import QtQuick 2.4 +import QmlBench 1.0 + +// Tests the creation of TextMetrics with some simple props +CreationBenchmark { + id: root; + count: 50; + staticCount: 2500; + + property string fontName: { + if (Qt.platform.os == "osx") { + return "Helvetica" + } else if (Qt.platform.os == "linux") { + return "Open Sans" + } else if (Qt.platform.os == "windows") { + return "Arial" + } + } + + delegate: Item { + TextMetrics { + font.family: root.fontName + text: "Hello world" + } + } +} + + + diff --git a/src/benchmarks/auto/creation/quick/red.frag b/src/benchmarks/auto/creation/quick/red.frag new file mode 100644 index 0000000..2aa500e --- /dev/null +++ b/src/benchmarks/auto/creation/quick/red.frag @@ -0,0 +1,8 @@ +#version 440 + +layout(location = 0) out vec4 fragColor; + +void main() +{ + fragColor = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/src/benchmarks/auto/creation/quick/red.frag.qsb b/src/benchmarks/auto/creation/quick/red.frag.qsb Binary files differnew file mode 100644 index 0000000..5bae5c1 --- /dev/null +++ b/src/benchmarks/auto/creation/quick/red.frag.qsb |