Source

Target

Commits (2)
  • Erik Verbruggen's avatar
    Fix animation benchmark · 17d9a17d
    Erik Verbruggen authored
    This was broken by 49a11e88
    
    .
    
    Change-Id: Ic7f261bce5e35b3dbcbdaf0b8718e08c56e55b39
    Reviewed-by: default avatarLars Knoll <lars.knoll@qt.io>
    17d9a17d
  • Erik Verbruggen's avatar
    Fix holistic benchmark · 0dbdfaa7
    Erik Verbruggen authored
    
    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: default avatarLars Knoll <lars.knoll@qt.io>
    0dbdfaa7
Showing with 13 additions and 6 deletions
......@@ -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;
}
}
......
......@@ -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();
......