From 0dbdfaa78d9c3ac0c1a9cfff440d753b159a3a14 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 22 Dec 2017 14:41:06 +0100 Subject: 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 --- tests/benchmarks/qml/holistic/tst_holistic.cpp | 13 ++++++++++--- 1 file 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 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(); -- cgit v1.2.3