aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2018-06-06 17:46:46 +0200
committerRobin Burchell <robin.burchell@crimson.no>2018-06-15 09:17:11 +0000
commitbaa2a81ec217c22a7996787c94aa47cafc249202 (patch)
treeaa84e4801e0daca4ac5e201baebada7588c971cf
parent524b539bad059e44225c9f645eca361b69bcc858 (diff)
sum10k: Add a fixed version, and note the breakage on the original
Erik noted that the test here is actually broken, but rather than change the benchmark, let's add a working one alongside it. Change-Id: I68058bedcc9760c86a600d5d34da0f8147062692 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--benchmarks/auto/js/sum10k.qml6
-rw-r--r--benchmarks/auto/js/sum10k_fixed.qml20
2 files changed, 26 insertions, 0 deletions
diff --git a/benchmarks/auto/js/sum10k.qml b/benchmarks/auto/js/sum10k.qml
index 0667945..ed9850f 100644
--- a/benchmarks/auto/js/sum10k.qml
+++ b/benchmarks/auto/js/sum10k.qml
@@ -2,6 +2,12 @@ import QtQuick 2.0
import QmlBench 1.0
// Tests the creation of items with a non-recursive function binding
+// Note: Through an unfortunate oversight, this benchmark is mildly broken.
+// The loop never updates the 'x' value. However, this benchmark has already
+// given some insights, and changing it (as any other benchmark) would
+// invalidate past data causing confusion, so it has not been altered.
+//
+// See sum10k_fixed for a working version.
CreationBenchmark {
id: root;
count: 50;
diff --git a/benchmarks/auto/js/sum10k_fixed.qml b/benchmarks/auto/js/sum10k_fixed.qml
new file mode 100644
index 0000000..b638a94
--- /dev/null
+++ b/benchmarks/auto/js/sum10k_fixed.qml
@@ -0,0 +1,20 @@
+import QtQuick 2.0
+import QmlBench 1.0
+
+// Tests the creation of items with a non-recursive function binding
+CreationBenchmark {
+ id: root;
+ count: 50;
+ staticCount: 1000;
+ delegate: Item {
+ x: sum(10000);
+ }
+
+ function sum(n) {
+ var x = 0;
+ for (var i=0; i<n; ++i)
+ x = x + 1;
+ return x;
+ }
+}
+