aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-19 10:49:56 +0100
committerLiang Qi <liang.qi@qt.io>2018-01-24 09:34:11 +0100
commit2570b801c74832a3c83a8b56ad0f76812969e190 (patch)
treec4bd64d8e6b15b507f51f550ba13a0c062528d65 /tests/benchmarks
parent1b96186d1418adcba85fdbfd794da2d2f6ea122d (diff)
parent706a6647db695cdeb854ef1bf956ded56b498f78 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: .qmake.conf src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/debugger/qqmlprofiler_p.h src/qml/jsruntime/qv4engine.cpp src/qml/memory/qv4mm.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlobjectcreator_p.h src/qml/types/qqmldelegatemodel.cpp src/quick/items/qquickitem_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/BLACKLIST tests/benchmarks/qml/holistic/tst_holistic.cpp Change-Id: I520f349ab4b048dd337d9647113564fc257865c2
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/qml/animation/tst_animation.cpp6
-rw-r--r--tests/benchmarks/qml/holistic/tst_holistic.cpp18
2 files changed, 13 insertions, 11 deletions
diff --git a/tests/benchmarks/qml/animation/tst_animation.cpp b/tests/benchmarks/qml/animation/tst_animation.cpp
index 27622ed013..f377c94f72 100644
--- a/tests/benchmarks/qml/animation/tst_animation.cpp
+++ b/tests/benchmarks/qml/animation/tst_animation.cpp
@@ -125,12 +125,12 @@ void tst_animation::animationelements_data()
void tst_animation::animationelements()
{
QFETCH(QString, type);
- QQmlType *t = QQmlMetaType::qmlType(type, 2, 0);
- if (!t || !t->isCreatable())
+ QQmlType t = QQmlMetaType::qmlType(type, 2, 0);
+ if (!t.isValid() || !t.isCreatable())
QSKIP("Non-creatable type");
QBENCHMARK {
- QObject *obj = t->create();
+ QObject *obj = t.create();
delete obj;
}
}
diff --git a/tests/benchmarks/qml/holistic/tst_holistic.cpp b/tests/benchmarks/qml/holistic/tst_holistic.cpp
index d7e71297f2..9186816a16 100644
--- a/tests/benchmarks/qml/holistic/tst_holistic.cpp
+++ b/tests/benchmarks/qml/holistic/tst_holistic.cpp
@@ -107,7 +107,6 @@ private slots:
void typeResolution_data();
void typeResolution();
-
};
tst_holistic::tst_holistic()
@@ -240,7 +239,6 @@ void tst_holistic::compilation_data()
void tst_holistic::compilation()
{
- QQmlEngine engine;
// This function benchmarks the cost of loading and compiling specified QML files.
// If "repetitions" is non-zero, each file from "files" will be compiled "repetitions"
// times, without clearing the engine's component cache between compilations.
@@ -250,6 +248,8 @@ void tst_holistic::compilation()
Q_ASSERT(files.size() > 0);
Q_ASSERT(repetitions > 0);
+ QQmlEngine engine;
+
QBENCHMARK {
engine.clearComponentCache();
for (int i = 0; i < repetitions; ++i) {
@@ -262,7 +262,6 @@ void tst_holistic::compilation()
void tst_holistic::instantiation()
{
- QQmlEngine engine;
// This function benchmarks the cost of instantiating components compiled from specified QML files.
// If "repetitions" is non-zero, each component compiled from "files" will be instantiated "repetitions"
// times, without clearing the component's instantiation cache between instantiations.
@@ -272,6 +271,8 @@ void tst_holistic::instantiation()
Q_ASSERT(files.size() > 0);
Q_ASSERT(repetitions > 0);
+ QQmlEngine engine;
+
QList<QQmlComponent*> components;
for (int i = 0; i < files.size(); ++i) {
QQmlComponent *c = new QQmlComponent(&engine, QUrl::fromLocalFile(files.at(i)));
@@ -297,7 +298,6 @@ void tst_holistic::instantiation()
void tst_holistic::creation()
{
- QQmlEngine engine;
// This function benchmarks the cost of loading, compiling and instantiating specified QML files.
// If "repetitions" is non-zero, each file from "files" will be created "repetitions"
// times, without clearing the engine's component cache between component creation.
@@ -307,6 +307,8 @@ void tst_holistic::creation()
Q_ASSERT(files.size() > 0);
Q_ASSERT(repetitions > 0);
+ QQmlEngine engine;
+
QBENCHMARK {
engine.clearComponentCache();
for (int i = 0; i < repetitions; ++i) {
@@ -360,7 +362,6 @@ void tst_holistic::dynamicity_data()
void tst_holistic::dynamicity()
{
- QQmlEngine engine;
// This function benchmarks the cost of "continued operation" - signal invocation,
// updating bindings, etc. Note that we take two different writeValues in order
// to force updates to occur, and we read to force lazy evaluation to occur.
@@ -371,6 +372,7 @@ void tst_holistic::dynamicity()
QFETCH(QVariant, writeValueTwo);
QFETCH(QString, readProperty);
+ QQmlEngine engine;
QQmlComponent c(&engine, file);
QObject *obj = c.create();
@@ -474,13 +476,13 @@ void tst_holistic::cppToJsDirect_data()
void tst_holistic::cppToJsDirect()
{
- QQmlEngine engine;
// This function benchmarks the cost of calling from CPP scope to JS scope
// (and possibly vice versa, if the invoked js method then calls to cpp).
QFETCH(QString, file);
QFETCH(QString, methodName);
+ QQmlEngine engine;
QQmlComponent c(&engine, file);
QObject *obj = c.create();
@@ -494,13 +496,13 @@ void tst_holistic::cppToJsDirect()
void tst_holistic::cppToJsIndirect()
{
- QQmlEngine engine;
// This function benchmarks the cost of binding scarce resources
// to properties of a QML component. The engine should automatically release such
// resources when they are no longer used.
// The benchmark deliberately causes change signals to be emitted (and
// modifies the scarce resources) so that the properties are updated.
+ QQmlEngine engine;
QQmlComponent c(&engine, QString(SRCDIR + QLatin1String("/data/scopeSwitching/ScarceTwo.qml")));
QObject *obj = c.create();
@@ -548,7 +550,6 @@ void tst_holistic::typeResolution_data()
void tst_holistic::typeResolution()
{
- QQmlEngine engine;
// This function benchmarks the cost of "continued operation" (signal invocation,
// updating bindings, etc) where the component has lots of nested items with
// lots of resolving required. Note that we take two different writeValues in order
@@ -565,6 +566,7 @@ void tst_holistic::typeResolution()
Q_ASSERT(propertyNameTwo.size() == propertyValueTwo.size());
Q_ASSERT(repetitions > 0);
+ QQmlEngine engine;
QQmlComponent c(&engine, file);
QObject *obj = c.create();