aboutsummaryrefslogtreecommitdiffstats
path: root/src/benchmarks/auto/animations
diff options
context:
space:
mode:
Diffstat (limited to 'src/benchmarks/auto/animations')
-rw-r--r--src/benchmarks/auto/animations/comparison/README.md17
-rw-r--r--src/benchmarks/auto/animations/comparison/moving-images-animations.qml28
-rw-r--r--src/benchmarks/auto/animations/comparison/moving-images-animators.qml28
-rw-r--r--src/benchmarks/auto/animations/comparison/moving-images-script.qml30
-rw-r--r--src/benchmarks/auto/animations/comparison/moving-images-simple.qml29
5 files changed, 132 insertions, 0 deletions
diff --git a/src/benchmarks/auto/animations/comparison/README.md b/src/benchmarks/auto/animations/comparison/README.md
new file mode 100644
index 0000000..a5c441d
--- /dev/null
+++ b/src/benchmarks/auto/animations/comparison/README.md
@@ -0,0 +1,17 @@
+# comparison
+
+These benchmarks compare a number of different ways of moving images around, and
+are help validate the casual gaming idea which should be very viable with QML.
+
+The benchmarks give an indication of how many animated items can run
+simultaneously in the UI. It should be in the thousands.
+
+One quirk if you run these is that on a threaded renderloop, the animation one
+runs faster than animators. This is because the work is broken into two major
+chunks. One is doing the animation while the other is doing the batching in the
+renderer and scheduling the rendering. If those happen on separate threads, we
+get better parallelization so 'animation' comes out better.
+
+However, if you try again with QSG_RENDER_LOOP=windows in the environment,
+you'll see that if it all happens on the same thread, then animators are a bit
+cheaper (because they are simpler).
diff --git a/src/benchmarks/auto/animations/comparison/moving-images-animations.qml b/src/benchmarks/auto/animations/comparison/moving-images-animations.qml
new file mode 100644
index 0000000..e1ba723
--- /dev/null
+++ b/src/benchmarks/auto/animations/comparison/moving-images-animations.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.2
+import QmlBench 1.0
+
+// Move images around using Animation types, to be compared with a number of
+// other similar ways to move them around.
+Benchmark {
+ id: root;
+
+ count: 500
+ staticCount: 20000
+
+ Repeater {
+ model: root.count
+ Image {
+ source: "qrc:///shared/butterfly-wide.png"
+ x: QmlBench.getRandom() * (root.width - width)
+ y: QmlBench.getRandom() * (root.height - height)
+ width: 40
+ height: 40
+
+ SequentialAnimation on rotation {
+ NumberAnimation { from: -10; to: 10; duration: 500; easing.type: Easing.InOutCubic }
+ NumberAnimation { from: 10; to: -10; duration: 500; easing.type: Easing.InOutCubic }
+ loops: Animation.Infinite
+ }
+ }
+ }
+}
diff --git a/src/benchmarks/auto/animations/comparison/moving-images-animators.qml b/src/benchmarks/auto/animations/comparison/moving-images-animators.qml
new file mode 100644
index 0000000..b0c17a1
--- /dev/null
+++ b/src/benchmarks/auto/animations/comparison/moving-images-animators.qml
@@ -0,0 +1,28 @@
+import QtQuick 2.2
+import QmlBench 1.0
+
+// Move images around using Animator types, to be compared with a number of
+// other similar ways to move them around.
+Benchmark {
+ id: root;
+
+ count: 500
+ staticCount: 20000
+
+ Repeater {
+ model: root.count
+ Image {
+ source: "qrc:///shared/butterfly-wide.png"
+ x: QmlBench.getRandom() * (root.width - width)
+ y: QmlBench.getRandom() * (root.height - height)
+ width: 40
+ height: 40
+
+ SequentialAnimation on rotation {
+ RotationAnimator { from: -10; to: 10; duration: 500; easing.type: Easing.InOutCubic }
+ RotationAnimator { from: 10; to: -10; duration: 500; easing.type: Easing.InOutCubic }
+ loops: Animation.Infinite
+ }
+ }
+ }
+}
diff --git a/src/benchmarks/auto/animations/comparison/moving-images-script.qml b/src/benchmarks/auto/animations/comparison/moving-images-script.qml
new file mode 100644
index 0000000..54f0c0c
--- /dev/null
+++ b/src/benchmarks/auto/animations/comparison/moving-images-script.qml
@@ -0,0 +1,30 @@
+import QtQuick 2.2
+import QmlBench 1.0
+
+// Move images around using a property binding, to be compared with a number of
+// other similar ways to move them around.
+Benchmark {
+ id: root;
+
+ count: 500
+ staticCount: 20000
+
+ Repeater {
+ model: root.count
+ Image {
+ source: "qrc:///shared/butterfly-wide.png"
+ x: QmlBench.getRandom() * (root.width - width)
+ y: QmlBench.getRandom() * (root.height - height)
+ width: 40
+ height: 40
+
+ property real t;
+ rotation: 10 * Math.sin(t * Math.PI * 2 + Math.PI);
+
+ SequentialAnimation on t {
+ NumberAnimation { from: 0; to: 1; duration: 1000; }
+ loops: Animation.Infinite
+ }
+ }
+ }
+}
diff --git a/src/benchmarks/auto/animations/comparison/moving-images-simple.qml b/src/benchmarks/auto/animations/comparison/moving-images-simple.qml
new file mode 100644
index 0000000..39cc05e
--- /dev/null
+++ b/src/benchmarks/auto/animations/comparison/moving-images-simple.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.2
+import QmlBench 1.0
+
+// Move images around using a global property binding, to be compared with a
+// number of other similar ways to move them around.
+Benchmark {
+ id: root;
+
+ count: 500
+ staticCount: 20000
+
+ property int frameCount
+ onTChanged: {
+ frameCount++
+ }
+
+ Repeater {
+ model: root.count
+ Image {
+ source: "qrc:///shared/butterfly-wide.png"
+ x: QmlBench.getRandom() * (root.width - width)
+ y: QmlBench.getRandom() * (root.height - height)
+ width: 40
+ height: 40
+ rotation: index + frameCount
+ }
+ }
+}
+