aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-03-22 14:34:43 +0100
committerRobin Burchell <robin.burchell@crimson.no>2017-03-23 09:01:44 +0000
commit94e84d25731e152ad6950131fc46c6af05714227 (patch)
tree746eefee7681c48712202c7b2b24bc2ce58790bc /benchmarks
parent85bb66420408df2c9904f489f6e67b828ba8bb44 (diff)
Add benchmarks for validator type creation
As expected, RegExpValidator is the slow one of the bunch (around 70% slower than the others). Surprisingly, it looks like IntValidator might be a tiny bit faster than DoubleValidator, but it's within margin of error anyway. Change-Id: I1a6ce9cf8eca1fc75d4122cc0ba6db5ad2e582c7 Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/auto/creation/quick.validators/delegates_doublevalidator.qml29
-rw-r--r--benchmarks/auto/creation/quick.validators/delegates_intvalidator.qml27
-rw-r--r--benchmarks/auto/creation/quick.validators/delegates_regexpvalidator.qml26
3 files changed, 82 insertions, 0 deletions
diff --git a/benchmarks/auto/creation/quick.validators/delegates_doublevalidator.qml b/benchmarks/auto/creation/quick.validators/delegates_doublevalidator.qml
new file mode 100644
index 0000000..5e78e59
--- /dev/null
+++ b/benchmarks/auto/creation/quick.validators/delegates_doublevalidator.qml
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+
+Item {
+ id: root;
+ property int count: 50;
+ property int staticCount: 2500;
+
+ property real t;
+ NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite }
+ onTChanged: {
+ repeater.model = 0;
+ repeater.model = root.count
+ }
+
+ Component.onCompleted: repeater.model = root.count
+
+ Repeater {
+ id: repeater
+
+ Item {
+ property DoubleValidator validator: DoubleValidator {
+ top: 100
+ bottom: 0
+ decimals: 2
+ }
+ }
+ }
+}
+
diff --git a/benchmarks/auto/creation/quick.validators/delegates_intvalidator.qml b/benchmarks/auto/creation/quick.validators/delegates_intvalidator.qml
new file mode 100644
index 0000000..5779558
--- /dev/null
+++ b/benchmarks/auto/creation/quick.validators/delegates_intvalidator.qml
@@ -0,0 +1,27 @@
+import QtQuick 2.0
+
+Item {
+ id: root;
+ property int count: 50;
+ property int staticCount: 2500;
+
+ property real t;
+ NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite }
+ onTChanged: {
+ repeater.model = 0;
+ repeater.model = root.count
+ }
+
+ Component.onCompleted: repeater.model = root.count
+
+ Repeater {
+ id: repeater
+ Item {
+ property IntValidator validator: IntValidator {
+ top: 100
+ bottom: 0
+ }
+ }
+ }
+}
+
diff --git a/benchmarks/auto/creation/quick.validators/delegates_regexpvalidator.qml b/benchmarks/auto/creation/quick.validators/delegates_regexpvalidator.qml
new file mode 100644
index 0000000..38e3379
--- /dev/null
+++ b/benchmarks/auto/creation/quick.validators/delegates_regexpvalidator.qml
@@ -0,0 +1,26 @@
+import QtQuick 2.0
+
+Item {
+ id: root;
+ property int count: 50;
+ property int staticCount: 2500;
+
+ property real t;
+ NumberAnimation on t { from: 0; to: 1; duration: 1000; loops: Animation.Infinite }
+ onTChanged: {
+ repeater.model = 0;
+ repeater.model = root.count
+ }
+
+ Component.onCompleted: repeater.model = root.count
+
+ Repeater {
+ id: repeater
+ Item {
+ property RegExpValidator validator: RegExpValidator {
+ regExp: /.*/
+ }
+ }
+ }
+}
+