aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-04-07 12:39:21 +0200
committerRobin Burchell <robin.burchell@crimson.no>2017-04-07 11:04:55 +0000
commit2de0afd47fbf299ee0144272d39ca9ad9acf6c1b (patch)
tree2e842393d2863985a8ae1805336dc5cc21c8c23c
parent1a7fee6a933b3019ee6f43cd598d5c93a209d088 (diff)
animations: Attempt to stabilize
Remove Grid and sizing stuff, use the bare minimum here. Create items once, position them, and run animations repeatedly. Also remove the PauseAnimation (which in itself is hard on predictable work, which the benchmark kind of relies on) and Math.random (which makes that even more hard to predict and not easily reproduced) Change-Id: I3e74dca1ab8a302048575dcfb607cb84c2d2e822 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
-rw-r--r--benchmarks/auto/animations/comparison/moving-images-animations.qml37
-rw-r--r--benchmarks/auto/animations/comparison/moving-images-animators.qml37
-rw-r--r--benchmarks/auto/animations/comparison/moving-images-script.qml39
3 files changed, 51 insertions, 62 deletions
diff --git a/benchmarks/auto/animations/comparison/moving-images-animations.qml b/benchmarks/auto/animations/comparison/moving-images-animations.qml
index 88e1901..c55d52d 100644
--- a/benchmarks/auto/animations/comparison/moving-images-animations.qml
+++ b/benchmarks/auto/animations/comparison/moving-images-animations.qml
@@ -1,28 +1,25 @@
import QtQuick 2.2
+import QmlBench 1.0
-Item {
+Benchmark {
id: root;
- property int size: Math.sqrt(width * height / count);
- property int count: 500
- property int staticCount: 20000
+ count: 500
+ staticCount: 20000
- Grid {
- width: root.width
- height: root.height
- columns: Math.ceil(root.width / root.size);
- rows: Math.ceil(root.height / root.size);
- Repeater {
- model: root.count
- Image {
- source: "../../../../shared/butterfly-wide.png"
- sourceSize: Qt.size(root.size, root.size);
- SequentialAnimation on rotation {
- PauseAnimation { duration: 200 + Math.random() * 200 }
- 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
- }
+ Repeater {
+ model: root.count
+ Image {
+ source: "../../../../shared/butterfly-wide.png"
+ x: Math.random() * (root.width - width)
+ y: Math.random() * (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/benchmarks/auto/animations/comparison/moving-images-animators.qml b/benchmarks/auto/animations/comparison/moving-images-animators.qml
index 95cb4a3..c7e267e 100644
--- a/benchmarks/auto/animations/comparison/moving-images-animators.qml
+++ b/benchmarks/auto/animations/comparison/moving-images-animators.qml
@@ -1,28 +1,25 @@
import QtQuick 2.2
+import QmlBench 1.0
-Item {
+Benchmark {
id: root;
- property int size: Math.sqrt(width * height / count);
- property int count: 500
- property int staticCount: 20000
+ count: 500
+ staticCount: 20000
- Grid {
- width: root.width
- height: root.height
- columns: Math.ceil(root.width / root.size);
- rows: Math.ceil(root.height / root.size);
- Repeater {
- model: root.count
- Image {
- source: "../../../../shared/butterfly-wide.png"
- sourceSize: Qt.size(root.size, root.size);
- SequentialAnimation on rotation {
- PauseAnimation { duration: 200 + Math.random() * 200 }
- 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
- }
+ Repeater {
+ model: root.count
+ Image {
+ source: "../../../../shared/butterfly-wide.png"
+ x: Math.random() * (root.width - width)
+ y: Math.random() * (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/benchmarks/auto/animations/comparison/moving-images-script.qml b/benchmarks/auto/animations/comparison/moving-images-script.qml
index 37b88f1..9315752 100644
--- a/benchmarks/auto/animations/comparison/moving-images-script.qml
+++ b/benchmarks/auto/animations/comparison/moving-images-script.qml
@@ -1,32 +1,27 @@
import QtQuick 2.2
+import QmlBench 1.0
-Item {
+Benchmark {
id: root;
- property int size: Math.sqrt(width * height / count);
- property string description: count + " " + size + "x" + size + " Image instances\nAnimation with JavaScript";
- property int count: 500
- property int staticCount: 20000
+ count: 500
+ staticCount: 20000
- Grid {
- width: root.width
- height: root.height
- columns: Math.ceil(root.width / root.size);
- rows: Math.ceil(root.height / root.size);
- Repeater {
- model: root.count
- Image {
- source: "../../../../shared/butterfly-wide.png"
- sourceSize: Qt.size(root.size, root.size);
+ Repeater {
+ model: root.count
+ Image {
+ source: "../../../../shared/butterfly-wide.png"
+ x: Math.random() * (root.width - width)
+ y: Math.random() * (root.height - height)
+ width: 40
+ height: 40
- property real t;
- rotation: 10 * Math.sin(t * Math.PI * 2 + Math.PI);
+ property real t;
+ rotation: 10 * Math.sin(t * Math.PI * 2 + Math.PI);
- SequentialAnimation on t {
- PauseAnimation { duration: 200 + Math.random() * 200 }
- NumberAnimation { from: 0; to: 1; duration: 1000; }
- loops: Animation.Infinite
- }
+ SequentialAnimation on t {
+ NumberAnimation { from: 0; to: 1; duration: 1000; }
+ loops: Animation.Infinite
}
}
}