diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-10-30 12:53:59 +0100 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-10-31 06:43:19 +0000 |
commit | ab770345f2882782e412a0e8244b27887e1b4f22 (patch) | |
tree | c40e3f19e2172cbfe7bb98590256da9a43f889fa | |
parent | 782db75b759e67fae03c406aab759cdcbc5c9883 (diff) |
Add internal random generator
In Qt 5.10 we introduce a new QRandomGenerator which is now
used by Math.random(), and there are signs that this is
significantly slower than qrand() which was used before. So
much so, that it is visible in many of the qmlbench benchmarks.
Note that this is a theory based on local runs and analysis of
the graphs and still needs to be proven.
Regardless, the qmlbench benchmarks are not intended to be
benchmarking Math.random(), it is just used to ensure the
positions tested are random. To eliminate that as a
possible cause for regressions, we instead introduce a
simple internal random function which just cycles through
a pregenerated array.
Note that this will reduce performance for all affected
tests on all branches of Qt, but it will hopefully reduce
the gap between Qt 5.9.0 and Qt 5.10.
Task-number: QTBUG-63922
Change-Id: Ib19c11323f38b23f9705e0d77a52a8a0f1157ac3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
103 files changed, 309 insertions, 202 deletions
diff --git a/benchmarks/auto/animations/comparison/moving-images-animations.qml b/benchmarks/auto/animations/comparison/moving-images-animations.qml index 17ff34a..b9ecb61 100644 --- a/benchmarks/auto/animations/comparison/moving-images-animations.qml +++ b/benchmarks/auto/animations/comparison/moving-images-animations.qml @@ -13,8 +13,8 @@ Benchmark { model: root.count Image { source: "../../../../shared/butterfly-wide.png" - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 40 height: 40 diff --git a/benchmarks/auto/animations/comparison/moving-images-animators.qml b/benchmarks/auto/animations/comparison/moving-images-animators.qml index c620d62..132c61b 100644 --- a/benchmarks/auto/animations/comparison/moving-images-animators.qml +++ b/benchmarks/auto/animations/comparison/moving-images-animators.qml @@ -13,8 +13,8 @@ Benchmark { model: root.count Image { source: "../../../../shared/butterfly-wide.png" - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 40 height: 40 diff --git a/benchmarks/auto/animations/comparison/moving-images-script.qml b/benchmarks/auto/animations/comparison/moving-images-script.qml index 2ea08fa..d2a2fcf 100644 --- a/benchmarks/auto/animations/comparison/moving-images-script.qml +++ b/benchmarks/auto/animations/comparison/moving-images-script.qml @@ -13,8 +13,8 @@ Benchmark { model: root.count Image { source: "../../../../shared/butterfly-wide.png" - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 40 height: 40 diff --git a/benchmarks/auto/animations/comparison/moving-images-simple.qml b/benchmarks/auto/animations/comparison/moving-images-simple.qml index 56fa2c3..1db6c6a 100644 --- a/benchmarks/auto/animations/comparison/moving-images-simple.qml +++ b/benchmarks/auto/animations/comparison/moving-images-simple.qml @@ -18,8 +18,8 @@ Benchmark { model: root.count Image { source: "../../../../shared/butterfly-wide.png" - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 40 height: 40 rotation: index + frameCount diff --git a/benchmarks/auto/canvas/canvas_text_simple.qml b/benchmarks/auto/canvas/canvas_text_simple.qml index 6f06585..45e5a59 100644 --- a/benchmarks/auto/canvas/canvas_text_simple.qml +++ b/benchmarks/auto/canvas/canvas_text_simple.qml @@ -21,7 +21,7 @@ Item { var str = "" + Math.floor( t * 1000 ) / 1000; for (var i = 0; i < root.count; ++i) { - ctx.fillText(str, Math.random() * root.width, Math.random() * root.height); + ctx.fillText(str, QmlBench.getRandom() * root.width, QmlBench.getRandom() * root.height); } } } diff --git a/benchmarks/auto/changes/changing_over_isolated.qml b/benchmarks/auto/changes/changing_over_isolated.qml index d4d8551..72f9f1a 100644 --- a/benchmarks/auto/changes/changing_over_isolated.qml +++ b/benchmarks/auto/changes/changing_over_isolated.qml @@ -22,11 +22,11 @@ CreationBenchmark { model: root.count Rectangle { - color: Qt.hsla(Math.random(), 0.9, 0.4) + color: Qt.hsla(QmlBench.getRandom(), 0.9, 0.4) width: 20 height: 20 - x: Math.random() * root.width - y: Math.random() * root.height + x: QmlBench.getRandom() * root.width + y: QmlBench.getRandom() * root.height Text { color: "white" diff --git a/benchmarks/auto/changes/changing_over_isolated_with_clip.qml b/benchmarks/auto/changes/changing_over_isolated_with_clip.qml index f7a0bc2..00fc58a 100644 --- a/benchmarks/auto/changes/changing_over_isolated_with_clip.qml +++ b/benchmarks/auto/changes/changing_over_isolated_with_clip.qml @@ -19,11 +19,11 @@ Item { model: root.count Rectangle { - color: Qt.hsla(Math.random(), 0.9, 0.4) + color: Qt.hsla(QmlBench.getRandom(), 0.9, 0.4) width: 20 height: 20 - x: Math.random() * root.width - y: Math.random() * root.height + x: QmlBench.getRandom() * root.width + y: QmlBench.getRandom() * root.height clip: true Text { diff --git a/benchmarks/auto/changes/changing_over_isolated_with_clip_rotated.qml b/benchmarks/auto/changes/changing_over_isolated_with_clip_rotated.qml index aefa3be..ff169fe 100644 --- a/benchmarks/auto/changes/changing_over_isolated_with_clip_rotated.qml +++ b/benchmarks/auto/changes/changing_over_isolated_with_clip_rotated.qml @@ -26,11 +26,11 @@ Item { model: root.count Rectangle { - color: Qt.hsla(Math.random(), 0.9, 0.4) + color: Qt.hsla(QmlBench.getRandom(), 0.9, 0.4) width: 20 height: 20 - x: Math.random() * root.width - y: Math.random() * root.height + x: QmlBench.getRandom() * root.width + y: QmlBench.getRandom() * root.height clip: true rotation: 10 diff --git a/benchmarks/auto/changes/changing_text_oneofmany.qml b/benchmarks/auto/changes/changing_text_oneofmany.qml index 5bab6bd..9a913b1 100644 --- a/benchmarks/auto/changes/changing_text_oneofmany.qml +++ b/benchmarks/auto/changes/changing_text_oneofmany.qml @@ -13,8 +13,8 @@ Item { id: repeater model: root.count Text { - x: Math.random() * root.width - y: Math.random() * root.height + x: QmlBench.getRandom() * root.width + y: QmlBench.getRandom() * root.height text: index == 0 ? Math.round(t) : index; } } diff --git a/benchmarks/auto/changes/changing_texts.qml b/benchmarks/auto/changes/changing_texts.qml index 9c13176..6e35482 100644 --- a/benchmarks/auto/changes/changing_texts.qml +++ b/benchmarks/auto/changes/changing_texts.qml @@ -13,8 +13,8 @@ Item { id: repeater model: root.count Text { - x: Math.random() * root.width - y: Math.random() * root.height + x: QmlBench.getRandom() * root.width + y: QmlBench.getRandom() * root.height text: Math.floor( root.t * 1000 ) / 1000; } } diff --git a/benchmarks/auto/creation/layouts/delegates_column.qml b/benchmarks/auto/creation/layouts/delegates_column.qml index e9b9d82..55be106 100644 --- a/benchmarks/auto/creation/layouts/delegates_column.qml +++ b/benchmarks/auto/creation/layouts/delegates_column.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: Column { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) Rectangle { width: 50 height: 10 diff --git a/benchmarks/auto/creation/layouts/delegates_columnlayout.qml b/benchmarks/auto/creation/layouts/delegates_columnlayout.qml index bb941a3..bbb3b44 100644 --- a/benchmarks/auto/creation/layouts/delegates_columnlayout.qml +++ b/benchmarks/auto/creation/layouts/delegates_columnlayout.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: ColumnLayout { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) Rectangle { width: 50 height: 10 diff --git a/benchmarks/auto/creation/layouts/delegates_flow.qml b/benchmarks/auto/creation/layouts/delegates_flow.qml index 974c08a..e7e1ad0 100644 --- a/benchmarks/auto/creation/layouts/delegates_flow.qml +++ b/benchmarks/auto/creation/layouts/delegates_flow.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: Flow { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) Rectangle { width: 50 height: 10 diff --git a/benchmarks/auto/creation/layouts/delegates_grid.qml b/benchmarks/auto/creation/layouts/delegates_grid.qml index fe40ccd..a5c7f5f 100644 --- a/benchmarks/auto/creation/layouts/delegates_grid.qml +++ b/benchmarks/auto/creation/layouts/delegates_grid.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: Grid { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) Rectangle { width: 50 height: 10 diff --git a/benchmarks/auto/creation/layouts/delegates_gridlayout.qml b/benchmarks/auto/creation/layouts/delegates_gridlayout.qml index 8cdd48a..0d152c8 100644 --- a/benchmarks/auto/creation/layouts/delegates_gridlayout.qml +++ b/benchmarks/auto/creation/layouts/delegates_gridlayout.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: GridLayout { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) columns: 2 Rectangle { width: 50 diff --git a/benchmarks/auto/creation/layouts/delegates_row.qml b/benchmarks/auto/creation/layouts/delegates_row.qml index 1734101..8f3f8ae 100644 --- a/benchmarks/auto/creation/layouts/delegates_row.qml +++ b/benchmarks/auto/creation/layouts/delegates_row.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: Row { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) Rectangle { width: 50 height: 10 diff --git a/benchmarks/auto/creation/layouts/delegates_rowlayout.qml b/benchmarks/auto/creation/layouts/delegates_rowlayout.qml index b35496a..4e001ea 100644 --- a/benchmarks/auto/creation/layouts/delegates_rowlayout.qml +++ b/benchmarks/auto/creation/layouts/delegates_rowlayout.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: RowLayout { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) Rectangle { width: 50 height: 10 diff --git a/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_cooperative.qml b/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_cooperative.qml index cf95eae..e9f7e49 100644 --- a/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_cooperative.qml +++ b/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_cooperative.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Canvas { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 renderTarget: Canvas.FramebufferObject diff --git a/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_immediate.qml b/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_immediate.qml index f726d9b..f9f55b3 100644 --- a/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_immediate.qml +++ b/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_immediate.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Canvas { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 renderTarget: Canvas.FramebufferObject diff --git a/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_threaded.qml b/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_threaded.qml index b16a891..dd351f9 100644 --- a/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_threaded.qml +++ b/benchmarks/auto/creation/quick.canvas/delegates_canvas_fbo_threaded.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Canvas { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 renderTarget: Canvas.FramebufferObject diff --git a/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_cooperative.qml b/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_cooperative.qml index 0e79715..1c2be52 100644 --- a/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_cooperative.qml +++ b/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_cooperative.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Canvas { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 renderTarget: Canvas.Image diff --git a/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_immediate.qml b/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_immediate.qml index d616a9a..3deb640 100644 --- a/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_immediate.qml +++ b/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_immediate.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Canvas { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 renderTarget: Canvas.Image diff --git a/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_threaded.qml b/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_threaded.qml index 94044c5..49d2587 100644 --- a/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_threaded.qml +++ b/benchmarks/auto/creation/quick.canvas/delegates_canvas_image_threaded.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Canvas { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 renderTarget: Canvas.Image diff --git a/benchmarks/auto/creation/quick.controls2/delegates_busyindicator.qml b/benchmarks/auto/creation/quick.controls2/delegates_busyindicator.qml index a554255..6706d51 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_busyindicator.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_busyindicator.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: BusyIndicator { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height running: index % 2 } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_button.qml b/benchmarks/auto/creation/quick.controls2/delegates_button.qml index de4bbba..ab9b939 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_button.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_button.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: Button { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "Button" down: index % 2 } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_checkbox.qml b/benchmarks/auto/creation/quick.controls2/delegates_checkbox.qml index e5474d6..4603acb 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_checkbox.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_checkbox.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: CheckBox { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "CheckBox" checked: index % 2 } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_combobox.qml b/benchmarks/auto/creation/quick.controls2/delegates_combobox.qml index 2d39e78..7eef93a 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_combobox.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_combobox.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 250 delegate: ComboBox { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height model: 5 currentIndex: index % count } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_dial.qml b/benchmarks/auto/creation/quick.controls2/delegates_dial.qml index 1699c32..a245f2c 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_dial.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_dial.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 500 delegate: Dial { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height value: index / root.staticCount } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_itemdelegate.qml b/benchmarks/auto/creation/quick.controls2/delegates_itemdelegate.qml index ccd89ab..61f7c64 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_itemdelegate.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_itemdelegate.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: ItemDelegate { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "ItemDelegate" down: index % 2 } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_label.qml b/benchmarks/auto/creation/quick.controls2/delegates_label.qml index 84a4b05..7624e90 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_label.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_label.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: Label { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "Qt Quick!" } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_menuitem.qml b/benchmarks/auto/creation/quick.controls2/delegates_menuitem.qml index 30ea4d7..adefbc7 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_menuitem.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_menuitem.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: MenuItem { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "MenuItem" checkable: index % 2 checked: index % 2 diff --git a/benchmarks/auto/creation/quick.controls2/delegates_progressbar.qml b/benchmarks/auto/creation/quick.controls2/delegates_progressbar.qml index 6b87685..6c2475d 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_progressbar.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_progressbar.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: ProgressBar { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height value: index / root.staticCount } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_radiobutton.qml b/benchmarks/auto/creation/quick.controls2/delegates_radiobutton.qml index 6efe020..86847cf 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_radiobutton.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_radiobutton.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: RadioButton { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "CheckBox" autoExclusive: false checked: index % 2 diff --git a/benchmarks/auto/creation/quick.controls2/delegates_scrollbar.qml b/benchmarks/auto/creation/quick.controls2/delegates_scrollbar.qml index a2c9858..8e73e9d 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_scrollbar.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_scrollbar.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: ScrollBar { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height height: 100 size: index / root.staticCount pressed: index % 2 diff --git a/benchmarks/auto/creation/quick.controls2/delegates_scrollview.qml b/benchmarks/auto/creation/quick.controls2/delegates_scrollview.qml index b80066b..eea7e34 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_scrollview.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_scrollview.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 250 delegate: ScrollView { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height width: 100 height: 100 Item { diff --git a/benchmarks/auto/creation/quick.controls2/delegates_slider.qml b/benchmarks/auto/creation/quick.controls2/delegates_slider.qml index 70c1485..bf6df75 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_slider.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_slider.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: Slider { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height value: index / root.staticCount } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_spinbox.qml b/benchmarks/auto/creation/quick.controls2/delegates_spinbox.qml index 3f197e8..4ac4a95 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_spinbox.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_spinbox.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 250 delegate: SpinBox { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height value: index / root.staticCount * to } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_switch.qml b/benchmarks/auto/creation/quick.controls2/delegates_switch.qml index 059e932..d780bd1 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_switch.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_switch.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: Switch { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "Switch" checked: index % 2 } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_tabbar.qml b/benchmarks/auto/creation/quick.controls2/delegates_tabbar.qml index ecfd80c..418deb5 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_tabbar.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_tabbar.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 250 delegate: TabBar { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height currentIndex: index / root.staticCount * count TabButton { text: "Tab1" diff --git a/benchmarks/auto/creation/quick.controls2/delegates_textarea.qml b/benchmarks/auto/creation/quick.controls2/delegates_textarea.qml index 09ade83..28d1fb0 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_textarea.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_textarea.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 500 delegate: TextArea { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "Text\nArea" } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_textfield.qml b/benchmarks/auto/creation/quick.controls2/delegates_textfield.qml index 2b688c1..6f03459 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_textfield.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_textfield.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 1000 delegate: TextField { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height text: "TextField" } } diff --git a/benchmarks/auto/creation/quick.controls2/delegates_tumbler.qml b/benchmarks/auto/creation/quick.controls2/delegates_tumbler.qml index 4ca3595..9d80215 100644 --- a/benchmarks/auto/creation/quick.controls2/delegates_tumbler.qml +++ b/benchmarks/auto/creation/quick.controls2/delegates_tumbler.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20 staticCount: 250 delegate: Tumbler { - x: Math.random() * root.width - width - y: Math.random() * root.height - height + x: QmlBench.getRandom() * root.width - width + y: QmlBench.getRandom() * root.height - height model: 5 currentIndex: index % count } diff --git a/benchmarks/auto/creation/quick.image/delegates_image.qml b/benchmarks/auto/creation/quick.image/delegates_image.qml index f144e84..6d692c1 100644 --- a/benchmarks/auto/creation/quick.image/delegates_image.qml +++ b/benchmarks/auto/creation/quick.image/delegates_image.qml @@ -14,8 +14,8 @@ CreationBenchmark { ]; delegate: Image { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) source: "../../../../shared/" + root.names[index % 3]; width: 20 height: 20 diff --git a/benchmarks/auto/creation/quick.image/delegates_image_alpha.qml b/benchmarks/auto/creation/quick.image/delegates_image_alpha.qml index 5f66ddb..e9649f2 100644 --- a/benchmarks/auto/creation/quick.image/delegates_image_alpha.qml +++ b/benchmarks/auto/creation/quick.image/delegates_image_alpha.qml @@ -9,8 +9,8 @@ CreationBenchmark { staticCount: 2500; delegate: Image { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) source: "../../../../shared/alpha.png" width: 20 height: 20 diff --git a/benchmarks/auto/creation/quick.image/delegates_image_antialiased.qml b/benchmarks/auto/creation/quick.image/delegates_image_antialiased.qml index b35e029..e22aa85 100644 --- a/benchmarks/auto/creation/quick.image/delegates_image_antialiased.qml +++ b/benchmarks/auto/creation/quick.image/delegates_image_antialiased.qml @@ -14,8 +14,8 @@ CreationBenchmark { ]; delegate: Image { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) source: "../../../../shared/" + root.names[index % 3]; width: 20 height: 20 diff --git a/benchmarks/auto/creation/quick.image/delegates_image_async.qml b/benchmarks/auto/creation/quick.image/delegates_image_async.qml index 77937a6..5c27029 100644 --- a/benchmarks/auto/creation/quick.image/delegates_image_async.qml +++ b/benchmarks/auto/creation/quick.image/delegates_image_async.qml @@ -14,8 +14,8 @@ CreationBenchmark { ]; delegate: Image { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) source: "../../../../shared/" + root.names[index % 3]; width: 20 height: 20 diff --git a/benchmarks/auto/creation/quick.image/delegates_image_solid.qml b/benchmarks/auto/creation/quick.image/delegates_image_solid.qml index 2ede025..3f05d71 100644 --- a/benchmarks/auto/creation/quick.image/delegates_image_solid.qml +++ b/benchmarks/auto/creation/quick.image/delegates_image_solid.qml @@ -9,8 +9,8 @@ CreationBenchmark { staticCount: 2500; delegate: Image { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) source: "../../../../shared/solid.png" width: 20 height: 20 diff --git a/benchmarks/auto/creation/quick.item/delegates_item.qml b/benchmarks/auto/creation/quick.item/delegates_item.qml index f1fcb8e..8d150f9 100644 --- a/benchmarks/auto/creation/quick.item/delegates_item.qml +++ b/benchmarks/auto/creation/quick.item/delegates_item.qml @@ -9,8 +9,8 @@ CreationBenchmark { count: 50 staticCount: 5000 delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick.item/delegates_item_bindings.qml b/benchmarks/auto/creation/quick.item/delegates_item_bindings.qml index 450d7dd..3dbcb13 100644 --- a/benchmarks/auto/creation/quick.item/delegates_item_bindings.qml +++ b/benchmarks/auto/creation/quick.item/delegates_item_bindings.qml @@ -8,8 +8,8 @@ CreationBenchmark { staticCount: 5000 delegate: Item { id: itemInstance - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 visible: 1 == 1 ? true : false diff --git a/benchmarks/auto/creation/quick.item/delegates_item_childrenRect.qml b/benchmarks/auto/creation/quick.item/delegates_item_childrenRect.qml index 17b529a..d445f05 100644 --- a/benchmarks/auto/creation/quick.item/delegates_item_childrenRect.qml +++ b/benchmarks/auto/creation/quick.item/delegates_item_childrenRect.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50 staticCount: 5000 delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: childrenRect.width height: childrenRect.height diff --git a/benchmarks/auto/creation/quick.item/delegates_item_script.qml b/benchmarks/auto/creation/quick.item/delegates_item_script.qml index 9bb9071..37fbb54 100644 --- a/benchmarks/auto/creation/quick.item/delegates_item_script.qml +++ b/benchmarks/auto/creation/quick.item/delegates_item_script.qml @@ -9,8 +9,8 @@ CreationBenchmark { staticCount: 5000 delegate: Item { Component.onCompleted: { - x = Math.random() * (root.width - width) - y = Math.random() * (root.height - height) + x = QmlBench.getRandom() * (root.width - width) + y = QmlBench.getRandom() * (root.height - height) width = 30 height = 15 } diff --git a/benchmarks/auto/creation/quick.item/delegates_item_states.qml b/benchmarks/auto/creation/quick.item/delegates_item_states.qml index 95e6ab4..2163d61 100644 --- a/benchmarks/auto/creation/quick.item/delegates_item_states.qml +++ b/benchmarks/auto/creation/quick.item/delegates_item_states.qml @@ -8,8 +8,8 @@ CreationBenchmark { staticCount: 5000 delegate: Item { id: itemInstance - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 states: [ diff --git a/benchmarks/auto/creation/quick.item/delegates_item_z.qml b/benchmarks/auto/creation/quick.item/delegates_item_z.qml index 947c944..791bcab 100644 --- a/benchmarks/auto/creation/quick.item/delegates_item_z.qml +++ b/benchmarks/auto/creation/quick.item/delegates_item_z.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50 staticCount: 5000 delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) z: index width: 30 height: 15 diff --git a/benchmarks/auto/creation/quick.item/item_anchors.qml b/benchmarks/auto/creation/quick.item/item_anchors.qml index 3d6cddd..1e0e8cc 100644 --- a/benchmarks/auto/creation/quick.item/item_anchors.qml +++ b/benchmarks/auto/creation/quick.item/item_anchors.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 diff --git a/benchmarks/auto/creation/quick.item/item_size.qml b/benchmarks/auto/creation/quick.item/item_size.qml index 1c6da93..cc02942 100644 --- a/benchmarks/auto/creation/quick.item/item_size.qml +++ b/benchmarks/auto/creation/quick.item/item_size.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 diff --git a/benchmarks/auto/creation/quick.rectangle/delegates_rect.qml b/benchmarks/auto/creation/quick.rectangle/delegates_rect.qml index a1f9a19..a840b1c 100644 --- a/benchmarks/auto/creation/quick.rectangle/delegates_rect.qml +++ b/benchmarks/auto/creation/quick.rectangle/delegates_rect.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Rectangle { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 color: "steelblue" diff --git a/benchmarks/auto/creation/quick.rectangle/delegates_rect_blended.qml b/benchmarks/auto/creation/quick.rectangle/delegates_rect_blended.qml index c199152..5baa902 100644 --- a/benchmarks/auto/creation/quick.rectangle/delegates_rect_blended.qml +++ b/benchmarks/auto/creation/quick.rectangle/delegates_rect_blended.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: Rectangle { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 color: Qt.hsla(0.7, 0.3, 0.6, 0.5); diff --git a/benchmarks/auto/creation/quick.rectangle/delegates_rect_border.qml b/benchmarks/auto/creation/quick.rectangle/delegates_rect_border.qml index 43b4ed1..86a47c2 100644 --- a/benchmarks/auto/creation/quick.rectangle/delegates_rect_border.qml +++ b/benchmarks/auto/creation/quick.rectangle/delegates_rect_border.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Rectangle { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 color: "steelblue" diff --git a/benchmarks/auto/creation/quick.rectangle/delegates_rect_gradient.qml b/benchmarks/auto/creation/quick.rectangle/delegates_rect_gradient.qml index faa4645..85c3158 100644 --- a/benchmarks/auto/creation/quick.rectangle/delegates_rect_gradient.qml +++ b/benchmarks/auto/creation/quick.rectangle/delegates_rect_gradient.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Rectangle { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 gradient: Gradient { diff --git a/benchmarks/auto/creation/quick.rectangle/delegates_rect_radius.qml b/benchmarks/auto/creation/quick.rectangle/delegates_rect_radius.qml index f71f3ed..693ede4 100644 --- a/benchmarks/auto/creation/quick.rectangle/delegates_rect_radius.qml +++ b/benchmarks/auto/creation/quick.rectangle/delegates_rect_radius.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Rectangle { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 color: "steelblue" diff --git a/benchmarks/auto/creation/quick.text/comparison/delegates_kerning.qml b/benchmarks/auto/creation/quick.text/comparison/delegates_kerning.qml index 5d9e60d..0782c4a 100644 --- a/benchmarks/auto/creation/quick.text/comparison/delegates_kerning.qml +++ b/benchmarks/auto/creation/quick.text/comparison/delegates_kerning.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "OATS FLAVOUR WAY" font.family: "Times New Roman" font.pixelSize: 10 diff --git a/benchmarks/auto/creation/quick.text/comparison/delegates_nokerning.qml b/benchmarks/auto/creation/quick.text/comparison/delegates_nokerning.qml index c8d2b10..9b9cbac 100644 --- a/benchmarks/auto/creation/quick.text/comparison/delegates_nokerning.qml +++ b/benchmarks/auto/creation/quick.text/comparison/delegates_nokerning.qml @@ -8,8 +8,8 @@ CreationBenchmark { staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "OATS FLAVOUR WAY" font.family: "Times New Roman" font.kerning: false diff --git a/benchmarks/auto/creation/quick.text/comparison/delegates_noshaping.qml b/benchmarks/auto/creation/quick.text/comparison/delegates_noshaping.qml index 849713c..5a29ff2 100644 --- a/benchmarks/auto/creation/quick.text/comparison/delegates_noshaping.qml +++ b/benchmarks/auto/creation/quick.text/comparison/delegates_noshaping.qml @@ -8,8 +8,8 @@ CreationBenchmark { staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "OATS FLAVOUR WAY" font.family: "Times New Roman" font.preferShaping: false diff --git a/benchmarks/auto/creation/quick.text/delegates_longtext.qml b/benchmarks/auto/creation/quick.text/delegates_longtext.qml index 0bf13ce..806d996 100644 --- a/benchmarks/auto/creation/quick.text/delegates_longtext.qml +++ b/benchmarks/auto/creation/quick.text/delegates_longtext.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 500; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: root.width * 0.33 wrapMode: Text.WordWrap font.pixelSize: 10 diff --git a/benchmarks/auto/creation/quick.text/delegates_longtext_arabic.qml b/benchmarks/auto/creation/quick.text/delegates_longtext_arabic.qml index a3d50cf..fd3434c 100644 --- a/benchmarks/auto/creation/quick.text/delegates_longtext_arabic.qml +++ b/benchmarks/auto/creation/quick.text/delegates_longtext_arabic.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 500; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: root.width * 0.33 wrapMode: Text.WordWrap font.pixelSize: 10 diff --git a/benchmarks/auto/creation/quick.text/delegates_longtext_chinese.qml b/benchmarks/auto/creation/quick.text/delegates_longtext_chinese.qml index dc803f9..95526ec 100644 --- a/benchmarks/auto/creation/quick.text/delegates_longtext_chinese.qml +++ b/benchmarks/auto/creation/quick.text/delegates_longtext_chinese.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 20; staticCount: 500; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: root.width * 0.33 wrapMode: Text.WordWrap font.pixelSize: 10 diff --git a/benchmarks/auto/creation/quick.text/delegates_longtext_hindi.qml b/benchmarks/auto/creation/quick.text/delegates_longtext_hindi.qml index 9158bc7..5f7aca0 100644 --- a/benchmarks/auto/creation/quick.text/delegates_longtext_hindi.qml +++ b/benchmarks/auto/creation/quick.text/delegates_longtext_hindi.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 500; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: root.width * 0.33 wrapMode: Text.WordWrap font.pixelSize: 10 diff --git a/benchmarks/auto/creation/quick.text/delegates_text.qml b/benchmarks/auto/creation/quick.text/delegates_text.qml index 7e092a5..95a72a4 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 } diff --git a/benchmarks/auto/creation/quick.text/delegates_text_arabic.qml b/benchmarks/auto/creation/quick.text/delegates_text_arabic.qml index 27a4503..b209113 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_arabic.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_arabic.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "مع مئات" font.pixelSize: 10 } diff --git a/benchmarks/auto/creation/quick.text/delegates_text_chinese.qml b/benchmarks/auto/creation/quick.text/delegates_text_chinese.qml index a0f2d95..1be0b0c 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_chinese.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_chinese.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) font.pixelSize: 10 text: "天地玄黄,宇宙洪荒。日月盈昃,辰宿列张。寒来暑往,秋收冬藏。闰余成岁,律吕调阳。云腾致雨,露结为霜。金生丽水,玉出崑冈。剑号巨阙,珠称夜光。果珍李柰,菜重芥姜。海咸河淡,鳞潜羽翔。龙师火帝,鸟官人皇。始制文字,乃服衣裳。推位让国,有虞陶唐。弔民伐罪,周发商汤。坐朝问道,垂拱平章。爱育黎首,臣伏戎羌。" } diff --git a/benchmarks/auto/creation/quick.text/delegates_text_decoration_bold.qml b/benchmarks/auto/creation/quick.text/delegates_text_decoration_bold.qml index a70c43a..8af788e 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_decoration_bold.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_decoration_bold.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 font.bold: true diff --git a/benchmarks/auto/creation/quick.text/delegates_text_decoration_italic.qml b/benchmarks/auto/creation/quick.text/delegates_text_decoration_italic.qml index 6673d2d..c4b4f32 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_decoration_italic.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_decoration_italic.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 font.italic: true diff --git a/benchmarks/auto/creation/quick.text/delegates_text_decoration_strikeout.qml b/benchmarks/auto/creation/quick.text/delegates_text_decoration_strikeout.qml index d7e21c2..e634a73 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_decoration_strikeout.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_decoration_strikeout.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 font.strikeout: true diff --git a/benchmarks/auto/creation/quick.text/delegates_text_decoration_underline.qml b/benchmarks/auto/creation/quick.text/delegates_text_decoration_underline.qml index 5010c32..e61efe1 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_decoration_underline.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_decoration_underline.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 font.underline: true diff --git a/benchmarks/auto/creation/quick.text/delegates_text_hindi.qml b/benchmarks/auto/creation/quick.text/delegates_text_hindi.qml index 190c473..2fecb49 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_hindi.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_hindi.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "गोपनीयता लाभान्वित" font.pixelSize: 10 } diff --git a/benchmarks/auto/creation/quick.text/delegates_text_nativerendering.qml b/benchmarks/auto/creation/quick.text/delegates_text_nativerendering.qml index bdbe4ae..2927c48 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_nativerendering.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_nativerendering.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 renderType: Text.NativeRendering diff --git a/benchmarks/auto/creation/quick.text/delegates_text_plain.qml b/benchmarks/auto/creation/quick.text/delegates_text_plain.qml index aef77db..a060e9d 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_plain.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_plain.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 textFormat: Text.PlainText diff --git a/benchmarks/auto/creation/quick.text/delegates_text_richtext.qml b/benchmarks/auto/creation/quick.text/delegates_text_richtext.qml index 7d21e86..99aaa71 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_richtext.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_richtext.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 textFormat: Text.RichText diff --git a/benchmarks/auto/creation/quick.text/delegates_text_styled.qml b/benchmarks/auto/creation/quick.text/delegates_text_styled.qml index ccec424..c89d22d 100644 --- a/benchmarks/auto/creation/quick.text/delegates_text_styled.qml +++ b/benchmarks/auto/creation/quick.text/delegates_text_styled.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 1000; delegate: Text { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 textFormat: Text.StyledText diff --git a/benchmarks/auto/creation/quick.text/delegates_textedit.qml b/benchmarks/auto/creation/quick.text/delegates_textedit.qml index a179e85..cf7921b 100644 --- a/benchmarks/auto/creation/quick.text/delegates_textedit.qml +++ b/benchmarks/auto/creation/quick.text/delegates_textedit.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: TextEdit { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 } diff --git a/benchmarks/auto/creation/quick.text/delegates_textinput.qml b/benchmarks/auto/creation/quick.text/delegates_textinput.qml index 2f03563..727c9ea 100644 --- a/benchmarks/auto/creation/quick.text/delegates_textinput.qml +++ b/benchmarks/auto/creation/quick.text/delegates_textinput.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 20; staticCount: 1000; delegate: TextInput { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) text: "Qt Quick!" font.pixelSize: 10 } diff --git a/benchmarks/auto/creation/quick.transforms/delegates_item_rotated.qml b/benchmarks/auto/creation/quick.transforms/delegates_item_rotated.qml index 8c36083..f7b9ed2 100644 --- a/benchmarks/auto/creation/quick.transforms/delegates_item_rotated.qml +++ b/benchmarks/auto/creation/quick.transforms/delegates_item_rotated.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 rotation: 45 diff --git a/benchmarks/auto/creation/quick.transforms/delegates_item_rotated_transform.qml b/benchmarks/auto/creation/quick.transforms/delegates_item_rotated_transform.qml index 055f13f..f1a2e8f 100644 --- a/benchmarks/auto/creation/quick.transforms/delegates_item_rotated_transform.qml +++ b/benchmarks/auto/creation/quick.transforms/delegates_item_rotated_transform.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 transform: Rotation { diff --git a/benchmarks/auto/creation/quick.transforms/delegates_item_scaled.qml b/benchmarks/auto/creation/quick.transforms/delegates_item_scaled.qml index 7121976..d8c0c74 100644 --- a/benchmarks/auto/creation/quick.transforms/delegates_item_scaled.qml +++ b/benchmarks/auto/creation/quick.transforms/delegates_item_scaled.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 scale: 10 diff --git a/benchmarks/auto/creation/quick.transforms/delegates_item_scaled_transform.qml b/benchmarks/auto/creation/quick.transforms/delegates_item_scaled_transform.qml index b017921..851fcb8 100644 --- a/benchmarks/auto/creation/quick.transforms/delegates_item_scaled_transform.qml +++ b/benchmarks/auto/creation/quick.transforms/delegates_item_scaled_transform.qml @@ -8,8 +8,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 transform: Scale { diff --git a/benchmarks/auto/creation/quick.transforms/delegates_item_translated.qml b/benchmarks/auto/creation/quick.transforms/delegates_item_translated.qml index d8cf00c..8669e29 100644 --- a/benchmarks/auto/creation/quick.transforms/delegates_item_translated.qml +++ b/benchmarks/auto/creation/quick.transforms/delegates_item_translated.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: Item { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 transform: Translate { diff --git a/benchmarks/auto/creation/quick/delegates_flickable.qml b/benchmarks/auto/creation/quick/delegates_flickable.qml index 1a53f61..303570e 100644 --- a/benchmarks/auto/creation/quick/delegates_flickable.qml +++ b/benchmarks/auto/creation/quick/delegates_flickable.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: Flickable { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_flipable.qml b/benchmarks/auto/creation/quick/delegates_flipable.qml index 77a05bb..15a29b3 100644 --- a/benchmarks/auto/creation/quick/delegates_flipable.qml +++ b/benchmarks/auto/creation/quick/delegates_flipable.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: Flipable { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_focusscope.qml b/benchmarks/auto/creation/quick/delegates_focusscope.qml index bcc2697..059ae2f 100644 --- a/benchmarks/auto/creation/quick/delegates_focusscope.qml +++ b/benchmarks/auto/creation/quick/delegates_focusscope.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: FocusScope { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_gridview.qml b/benchmarks/auto/creation/quick/delegates_gridview.qml index 88dfac3..386d865 100644 --- a/benchmarks/auto/creation/quick/delegates_gridview.qml +++ b/benchmarks/auto/creation/quick/delegates_gridview.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: GridView { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_listview.qml b/benchmarks/auto/creation/quick/delegates_listview.qml index ff930b5..413bbb2 100644 --- a/benchmarks/auto/creation/quick/delegates_listview.qml +++ b/benchmarks/auto/creation/quick/delegates_listview.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: ListView { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_loader.qml b/benchmarks/auto/creation/quick/delegates_loader.qml index 52c4cd8..7271f15 100644 --- a/benchmarks/auto/creation/quick/delegates_loader.qml +++ b/benchmarks/auto/creation/quick/delegates_loader.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: Loader { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 sourceComponent: anItemComponent diff --git a/benchmarks/auto/creation/quick/delegates_mousearea.qml b/benchmarks/auto/creation/quick/delegates_mousearea.qml index f63e687..eaf3ad0 100644 --- a/benchmarks/auto/creation/quick/delegates_mousearea.qml +++ b/benchmarks/auto/creation/quick/delegates_mousearea.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: MouseArea { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) hoverEnabled: true width: 30 height: 15 diff --git a/benchmarks/auto/creation/quick/delegates_multipointtoucharea.qml b/benchmarks/auto/creation/quick/delegates_multipointtoucharea.qml index dd5a2a4..68b4976 100644 --- a/benchmarks/auto/creation/quick/delegates_multipointtoucharea.qml +++ b/benchmarks/auto/creation/quick/delegates_multipointtoucharea.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: MultiPointTouchArea { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_pathview.qml b/benchmarks/auto/creation/quick/delegates_pathview.qml index 42af201..f370e3b 100644 --- a/benchmarks/auto/creation/quick/delegates_pathview.qml +++ b/benchmarks/auto/creation/quick/delegates_pathview.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: PathView { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_pincharea.qml b/benchmarks/auto/creation/quick/delegates_pincharea.qml index 5dca674..b89efc6 100644 --- a/benchmarks/auto/creation/quick/delegates_pincharea.qml +++ b/benchmarks/auto/creation/quick/delegates_pincharea.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 2500 delegate: PinchArea { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 } diff --git a/benchmarks/auto/creation/quick/delegates_shadereffect.qml b/benchmarks/auto/creation/quick/delegates_shadereffect.qml index 58ea5cb..0e0d057 100644 --- a/benchmarks/auto/creation/quick/delegates_shadereffect.qml +++ b/benchmarks/auto/creation/quick/delegates_shadereffect.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50; staticCount: 2500; delegate: ShaderEffect { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 fragmentShader: "void main() { gl_FragColor = vec4(1, 0, 0, 1); }" diff --git a/benchmarks/auto/creation/quick/delegates_shadereffect_props.qml b/benchmarks/auto/creation/quick/delegates_shadereffect_props.qml index 6d53309..bf52e81 100644 --- a/benchmarks/auto/creation/quick/delegates_shadereffect_props.qml +++ b/benchmarks/auto/creation/quick/delegates_shadereffect_props.qml @@ -14,8 +14,8 @@ CreationBenchmark { } delegate: ShaderEffect { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: sourceImage.width height: sourceImage.height supportsAtlasTextures: true diff --git a/benchmarks/auto/creation/quick/delegates_shadereffectsource.qml b/benchmarks/auto/creation/quick/delegates_shadereffectsource.qml index 1974986..4e021a6 100644 --- a/benchmarks/auto/creation/quick/delegates_shadereffectsource.qml +++ b/benchmarks/auto/creation/quick/delegates_shadereffectsource.qml @@ -7,8 +7,8 @@ CreationBenchmark { count: 50 staticCount: 500 delegate: ShaderEffectSource { - x: Math.random() * (root.width - width) - y: Math.random() * (root.height - height) + x: QmlBench.getRandom() * (root.width - width) + y: QmlBench.getRandom() * (root.height - height) width: 30 height: 15 sourceItem: sourceRectItem diff --git a/src/main.cpp b/src/main.cpp index 2861da6..91622d0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,6 +39,7 @@ #include "resultrecorder.h" #include "qcommandlineparser.h" #include "testmodel.h" +#include "qmlbench.h" Options Options::instance; @@ -381,6 +382,11 @@ int runSubProcess(QGuiApplication &app) return app.exec(); } +static QObject *qmlbench_singleton_provider(QQmlEngine *, QJSEngine *) +{ + return new QmlBench(); +} + int main(int argc, char **argv) { // We need to do this early on, so there's no interference from the shared @@ -392,6 +398,7 @@ int main(int argc, char **argv) qmlRegisterType(QUrl("qrc:/CreationBenchmark.qml"), "QmlBench", 1, 0, "CreationBenchmark"); qmlRegisterType(QUrl("qrc:/V8Benchmark.qml"), "QmlBench", 1, 0, "V8Benchmark"); qmlRegisterType<TestModel>("QmlBench", 1, 0, "TestModel"); + qmlRegisterSingletonType<QmlBench>("QmlBench", 1, 0, "QmlBench", qmlbench_singleton_provider); QScopedPointer<QCoreApplication> app; diff --git a/src/qmlbench.cpp b/src/qmlbench.cpp new file mode 100644 index 0000000..3d51cc5 --- /dev/null +++ b/src/qmlbench.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the qmlbench tool. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlbench.h" + +#define PREGENERATED_COUNT 10000 + +QmlBench::QmlBench(QObject *parent) + : QObject(parent) + , m_currentRandomNumberIndex(0) +{ + m_pregeneratedRandomNumbers = new qreal[PREGENERATED_COUNT]; + for (int i = 0; i < PREGENERATED_COUNT; ++i) + m_pregeneratedRandomNumbers[i] = qrand() / qreal(RAND_MAX); +} + +QmlBench::~QmlBench() +{ + delete[] m_pregeneratedRandomNumbers; +} + +qreal QmlBench::getRandom() +{ + return m_pregeneratedRandomNumbers[(m_currentRandomNumberIndex++) % PREGENERATED_COUNT]; +} diff --git a/src/qmlbench.h b/src/qmlbench.h new file mode 100644 index 0000000..1b6e3bf --- /dev/null +++ b/src/qmlbench.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the qmlbench tool. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLBENCH_H +#define QMLBENCH_H + +#include <QObject> + +class QmlBench : public QObject +{ + Q_OBJECT +public: + explicit QmlBench(QObject *parent = nullptr); + ~QmlBench(); + + Q_INVOKABLE qreal getRandom(); + +private: + qreal *m_pregeneratedRandomNumbers; + uint m_currentRandomNumberIndex; +}; + +#endif // QMLBENCH_H diff --git a/src/src.pro b/src/src.pro index 8a5ba3f..2e91e92 100644 --- a/src/src.pro +++ b/src/src.pro @@ -8,14 +8,16 @@ SOURCES += \ main.cpp \ resultrecorder.cpp \ benchmarkrunner.cpp \ - testmodel.cpp + testmodel.cpp \ + qmlbench.cpp HEADERS += \ resultrecorder.h \ benchmarkrunner.h \ benchmark.h \ options.h \ - testmodel.h + testmodel.h \ + qmlbench.h equals(QT_MAJOR_VERSION, 5): lessThan(QT_MINOR_VERSION, 2) { SOURCES += \ |