aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2017-12-22 14:41:06 +0100
committerLars Knoll <lars.knoll@qt.io>2018-01-02 09:52:04 +0000
commit0dbdfaa78d9c3ac0c1a9cfff440d753b159a3a14 (patch)
tree82c63796a0b0e034fe6fd0306c1e92c864b89cca /tests
parent17d9a17db4ea2cac900325f3bec5559bd100f275 (diff)
Fix holistic benchmark
Each test now uses its own QQmlEngine, instead of using a single instance across all benchmarks. The effect is that peak heap usage (on macos) is now about 77MB, where it previously peaked at 770MB. This benchmark would actually crash on some platforms due to excessive malloc/mmap usage. Change-Id: I214f7b9b3d8c5565c0578b82c9c144ec87ed0f2b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/benchmarks/qml/holistic/tst_holistic.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/benchmarks/qml/holistic/tst_holistic.cpp b/tests/benchmarks/qml/holistic/tst_holistic.cpp
index 791ae6812b..9186816a16 100644
--- a/tests/benchmarks/qml/holistic/tst_holistic.cpp
+++ b/tests/benchmarks/qml/holistic/tst_holistic.cpp
@@ -107,9 +107,6 @@ private slots:
void typeResolution_data();
void typeResolution();
-
-private:
- QQmlEngine engine;
};
tst_holistic::tst_holistic()
@@ -251,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) {
@@ -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)));
@@ -306,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) {
@@ -369,6 +372,7 @@ void tst_holistic::dynamicity()
QFETCH(QVariant, writeValueTwo);
QFETCH(QString, readProperty);
+ QQmlEngine engine;
QQmlComponent c(&engine, file);
QObject *obj = c.create();
@@ -478,6 +482,7 @@ void tst_holistic::cppToJsDirect()
QFETCH(QString, file);
QFETCH(QString, methodName);
+ QQmlEngine engine;
QQmlComponent c(&engine, file);
QObject *obj = c.create();
@@ -497,6 +502,7 @@ void tst_holistic::cppToJsIndirect()
// 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();
@@ -560,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();