aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-17 10:57:38 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-17 10:57:38 +0200
commit7e609f6d109f8bebb7e2fe4bd8867c5a4f8ece3d (patch)
treeecbd4f56e83a84233d42928e5554709ca8832ce1 /tests/benchmarks
parent78f5b9e7f7295b9ba11da6908713fb938a1e0b90 (diff)
parentc0f3c8ae5cee3ecda1ac8829336aa95cbe4d330e (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4isel_moth.cpp src/qml/compiler/qv4ssa_p.h src/qml/qml/qqmlobjectcreator.cpp Change-Id: I8bb7fe773d657f908f20ee5e72c2b9bd643f6260
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/qml/creation/creation.pro2
-rw-r--r--tests/benchmarks/qml/creation/tst_creation.cpp57
-rw-r--r--tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp147
-rw-r--r--tests/benchmarks/qml/qml.pro5
-rw-r--r--tests/benchmarks/qml/qqmlimage/image.pngbin611 -> 0 bytes
-rw-r--r--tests/benchmarks/qml/qqmlimage/qqmlimage.pro11
-rw-r--r--tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp95
7 files changed, 17 insertions, 300 deletions
diff --git a/tests/benchmarks/qml/creation/creation.pro b/tests/benchmarks/qml/creation/creation.pro
index bb4d2841fe..42faf729a0 100644
--- a/tests/benchmarks/qml/creation/creation.pro
+++ b/tests/benchmarks/qml/creation/creation.pro
@@ -1,7 +1,7 @@
CONFIG += benchmark
TEMPLATE = app
TARGET = tst_creation
-QT += core-private gui-private qml-private quick-private widgets testlib
+QT += core-private gui-private qml-private quick-private testlib
macx:CONFIG -= app_bundle
SOURCES += tst_creation.cpp
diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp
index ca5802a8e7..a1c09db158 100644
--- a/tests/benchmarks/qml/creation/tst_creation.cpp
+++ b/tests/benchmarks/qml/creation/tst_creation.cpp
@@ -31,8 +31,6 @@
#include <QQmlComponent>
#include <private/qqmlmetatype_p.h>
#include <QDebug>
-#include <QGraphicsScene>
-#include <QGraphicsItem>
#include <QQuickItem>
#include <QQmlContext>
#include <private/qobject_p.h>
@@ -47,7 +45,6 @@ private slots:
void qobject_cpp();
void qobject_qml();
void qobject_qmltype();
- void qobject_alloc();
void qobject_10flat_qml();
void qobject_10flat_cpp();
@@ -62,9 +59,6 @@ private slots:
void itemtree_qml();
void itemtree_scene_cpp();
- void elements_data();
- void elements();
-
void itemtests_qml_data();
void itemtests_qml();
@@ -210,35 +204,6 @@ void tst_creation::qobject_qmltype()
}
}
-struct QObjectFakeData {
- char data[sizeof(QObjectPrivate)];
-};
-
-struct QObjectFake {
- QObjectFake();
- virtual ~QObjectFake();
-private:
- QObjectFakeData *d;
-};
-
-QObjectFake::QObjectFake()
-{
- d = new QObjectFakeData;
-}
-
-QObjectFake::~QObjectFake()
-{
- delete d;
-}
-
-void tst_creation::qobject_alloc()
-{
- QBENCHMARK {
- QObjectFake *obj = new QObjectFake;
- delete obj;
- }
-}
-
struct QQmlGraphics_Derived : public QObject
{
void setParent_noEvent(QObject *parent) {
@@ -333,28 +298,6 @@ void tst_creation::itemtree_scene_cpp()
delete root;
}
-void tst_creation::elements_data()
-{
- QTest::addColumn<QString>("type");
-
- QList<QString> types = QQmlMetaType::qmlTypeNames();
- foreach (QString type, types)
- QTest::newRow(type.toLatin1()) << type;
-}
-
-void tst_creation::elements()
-{
- QFETCH(QString, type);
- QQmlType *t = QQmlMetaType::qmlType(type, 2, 0);
- if (!t || !t->isCreatable())
- QSKIP("Non-creatable type");
-
- QBENCHMARK {
- QObject *obj = t->create();
- delete obj;
- }
-}
-
void tst_creation::itemtests_qml_data()
{
QTest::addColumn<QString>("filepath");
diff --git a/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp b/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp
index 5513dcb9a7..d7c54703ad 100644
--- a/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp
+++ b/tests/benchmarks/qml/librarymetrics_performance/tst_librarymetrics_performance.cpp
@@ -36,9 +36,6 @@
// for the standard set of elements, properties and expressions which
// are provided in the QtDeclarative library (QtQml and QtQuick).
-#define AVERAGE_OVER_N 10
-#define IGNORE_N_OUTLIERS 2
-
class ModuleApi : public QObject
{
Q_OBJECT
@@ -214,123 +211,37 @@ void tst_librarymetrics_performance::compilation()
}
}
- QList<qint64> nResults;
-
- // generate AVERAGE_OVER_N results
- for (int i = 0; i < AVERAGE_OVER_N; ++i) {
+ QBENCHMARK {
cleanState(&e);
- {
- QElapsedTimer et;
- et.start();
- QQmlComponent c(e, this);
- c.loadUrl(qmlfile); // just compile.
- qint64 etime = et.nsecsElapsed();
- nResults.append(etime);
- }
- }
-
- // sort the list
- qSort(nResults);
-
- // remove IGNORE_N_OUTLIERS*2 from ONLY the worst end (remove gc interference)
- for (int i = 0; i < IGNORE_N_OUTLIERS; ++i) {
- if (!nResults.isEmpty()) nResults.removeLast();
- if (!nResults.isEmpty()) nResults.removeLast();
+ QQmlComponent c(e, this);
+ c.loadUrl(qmlfile); // just compile.
}
-
- // now generate an average
- qint64 totaltime = 0;
- if (nResults.size() == 0) nResults.append(9999);
- for (int i = 0; i < nResults.size(); ++i)
- totaltime += nResults.at(i);
- double average = ((double)totaltime) / nResults.count();
-
- // and return it as the result
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds);
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); // twice to workaround bug in QTestLib
}
void tst_librarymetrics_performance::instantiation_cached()
{
QFETCH(QUrl, qmlfile);
-
cleanState(&e);
- QList<qint64> nResults;
- // generate AVERAGE_OVER_N results
- for (int i = 0; i < AVERAGE_OVER_N; ++i) {
- QElapsedTimer et;
- et.start();
+ QBENCHMARK {
QQmlComponent c(e, this);
c.loadUrl(qmlfile); // just compile.
QObject *o = c.create();
- qint64 etime = et.nsecsElapsed();
- nResults.append(etime);
delete o;
}
-
- // sort the list
- qSort(nResults);
-
- // remove IGNORE_N_OUTLIERS*2 from ONLY the worst end (remove gc interference)
- for (int i = 0; i < IGNORE_N_OUTLIERS; ++i) {
- if (!nResults.isEmpty()) nResults.removeLast();
- if (!nResults.isEmpty()) nResults.removeLast();
- }
-
- // now generate an average
- qint64 totaltime = 0;
- if (nResults.size() == 0) nResults.append(9999);
- for (int i = 0; i < nResults.size(); ++i)
- totaltime += nResults.at(i);
- double average = ((double)totaltime) / nResults.count();
-
- // and return it as the result
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds);
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); // twice to workaround bug in QTestLib
}
void tst_librarymetrics_performance::instantiation()
{
QFETCH(QUrl, qmlfile);
- cleanState(&e);
- QList<qint64> nResults;
-
- // generate AVERAGE_OVER_N results
- for (int i = 0; i < AVERAGE_OVER_N; ++i) {
+ QBENCHMARK {
cleanState(&e);
- {
- QElapsedTimer et;
- et.start();
- QQmlComponent c(e, this);
- c.loadUrl(qmlfile); // just compile.
- QObject *o = c.create();
- qint64 etime = et.nsecsElapsed();
- nResults.append(etime);
- delete o;
- }
- }
-
- // sort the list
- qSort(nResults);
-
- // remove IGNORE_N_OUTLIERS*2 from ONLY the worst end (remove gc interference)
- for (int i = 0; i < IGNORE_N_OUTLIERS; ++i) {
- if (!nResults.isEmpty()) nResults.removeLast();
- if (!nResults.isEmpty()) nResults.removeLast();
+ QQmlComponent c(e, this);
+ c.loadUrl(qmlfile); // just compile.
+ QObject *o = c.create();
+ delete o;
}
-
- // now generate an average
- qint64 totaltime = 0;
- if (nResults.size() == 0) nResults.append(9999);
- for (int i = 0; i < nResults.size(); ++i)
- totaltime += nResults.at(i);
- double average = ((double)totaltime) / nResults.count();
-
- // and return it as the result
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds);
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); // twice to workaround bug in QTestLib
}
void tst_librarymetrics_performance::positioners_data()
@@ -351,43 +262,13 @@ void tst_librarymetrics_performance::positioners()
{
QFETCH(QUrl, qmlfile);
- cleanState(&e);
- QList<qint64> nResults;
-
- // generate AVERAGE_OVER_N results
- for (int i = 0; i < AVERAGE_OVER_N; ++i) {
+ QBENCHMARK {
cleanState(&e);
- {
- QElapsedTimer et;
- et.start();
- QQmlComponent c(e, this);
- c.loadUrl(qmlfile); // just compile.
- QObject *o = c.create();
- qint64 etime = et.nsecsElapsed();
- nResults.append(etime);
- delete o;
- }
- }
-
- // sort the list
- qSort(nResults);
-
- // remove IGNORE_N_OUTLIERS*2 from ONLY the worst end (remove gc interference)
- for (int i = 0; i < IGNORE_N_OUTLIERS; ++i) {
- if (!nResults.isEmpty()) nResults.removeLast();
- if (!nResults.isEmpty()) nResults.removeLast();
+ QQmlComponent c(e, this);
+ c.loadUrl(qmlfile); // just compile.
+ QObject *o = c.create();
+ delete o;
}
-
- // now generate an average
- qint64 totaltime = 0;
- if (nResults.size() == 0) nResults.append(9999);
- for (int i = 0; i < nResults.size(); ++i)
- totaltime += nResults.at(i);
- double average = ((double)totaltime) / nResults.count();
-
- // and return it as the result
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds);
- QTest::setBenchmarkResult(average, QTest::WalltimeNanoseconds); // twice to workaround bug in QTestLib
}
QTEST_MAIN(tst_librarymetrics_performance)
diff --git a/tests/benchmarks/qml/qml.pro b/tests/benchmarks/qml/qml.pro
index 5d48ec0067..2cf2dff413 100644
--- a/tests/benchmarks/qml/qml.pro
+++ b/tests/benchmarks/qml/qml.pro
@@ -7,13 +7,12 @@ SUBDIRS += \
holistic \
qqmlchangeset \
qqmlcomponent \
- qqmlimage \
qqmlmetaproperty \
librarymetrics_performance \
# script \ ### FIXME: doesn't build
- js
+ js \
+ creation
qtHaveModule(opengl): SUBDIRS += painting qquickwindow
-qtHaveModule(widgets): SUBDIRS += creation
include(../trusted-benchmarks.pri)
diff --git a/tests/benchmarks/qml/qqmlimage/image.png b/tests/benchmarks/qml/qqmlimage/image.png
deleted file mode 100644
index 623d36233d..0000000000
--- a/tests/benchmarks/qml/qqmlimage/image.png
+++ /dev/null
Binary files differ
diff --git a/tests/benchmarks/qml/qqmlimage/qqmlimage.pro b/tests/benchmarks/qml/qqmlimage/qqmlimage.pro
deleted file mode 100644
index 421f232a4f..0000000000
--- a/tests/benchmarks/qml/qqmlimage/qqmlimage.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-CONFIG += benchmark
-TEMPLATE = app
-TARGET = tst_qqmlimage
-QT += qml quick-private testlib
-macx:CONFIG -= app_bundle
-CONFIG += release
-
-SOURCES += tst_qqmlimage.cpp
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
-
diff --git a/tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp b/tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp
deleted file mode 100644
index 38fca802c5..0000000000
--- a/tests/benchmarks/qml/qqmlimage/tst_qqmlimage.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $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 <qtest.h>
-#include <QQmlEngine>
-#include <QQmlComponent>
-#include <private/qquickimage_p.h>
-
-class tst_qmlgraphicsimage : public QObject
-{
- Q_OBJECT
-public:
- tst_qmlgraphicsimage() {}
-
-private slots:
- void qmlgraphicsimage();
- void qmlgraphicsimage_file();
- void qmlgraphicsimage_url();
-
-private:
- QQmlEngine engine;
-};
-
-void tst_qmlgraphicsimage::qmlgraphicsimage()
-{
- int x = 0;
- QUrl url(SRCDIR "/image.png");
- QBENCHMARK {
- QUrl url2("http://localhost/image" + QString::number(x++) + ".png");
- QQuickImage *image = new QQuickImage;
- QQmlEngine::setContextForObject(image, engine.rootContext());
- delete image;
- }
-}
-
-void tst_qmlgraphicsimage::qmlgraphicsimage_file()
-{
- int x = 0;
- QUrl url(SRCDIR "/image.png");
- //get rid of initialization effects
- {
- QQuickImage *image = new QQuickImage;
- QQmlEngine::setContextForObject(image, engine.rootContext());
- image->setSource(url);
- }
- QBENCHMARK {
- QUrl url2("http://localhost/image" + QString::number(x++) + ".png");
- QQuickImage *image = new QQuickImage;
- QQmlEngine::setContextForObject(image, engine.rootContext());
- image->setSource(url);
- delete image;
- }
-}
-
-void tst_qmlgraphicsimage::qmlgraphicsimage_url()
-{
- int x = 0;
- QUrl url(SRCDIR "/image.png");
- QBENCHMARK {
- QUrl url2("http://localhost/image" + QString::number(x++) + ".png");
- QQuickImage *image = new QQuickImage;
- QQmlEngine::setContextForObject(image, engine.rootContext());
- image->setSource(url2);
- delete image;
- }
-}
-
-QTEST_MAIN(tst_qmlgraphicsimage)
-
-#include "tst_qqmlimage.moc"