From 4a66f34750b6e56610bb3c55c6c3ca25a8795a36 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 24 May 2010 10:41:28 +1000 Subject: Factor out initialization effects from declarative benchmarks. --- tests/benchmarks/declarative/compilation/tst_compilation.cpp | 6 ++++++ tests/benchmarks/declarative/creation/tst_creation.cpp | 4 ++++ .../declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp | 6 ++++++ tests/benchmarks/declarative/typeimports/tst_typeimports.cpp | 3 +++ 4 files changed, 19 insertions(+) diff --git a/tests/benchmarks/declarative/compilation/tst_compilation.cpp b/tests/benchmarks/declarative/compilation/tst_compilation.cpp index 0c6e917..2f4cd15 100644 --- a/tests/benchmarks/declarative/compilation/tst_compilation.cpp +++ b/tests/benchmarks/declarative/compilation/tst_compilation.cpp @@ -77,6 +77,12 @@ void tst_compilation::boomblock() QVERIFY(f.open(QIODevice::ReadOnly)); QByteArray data = f.readAll(); + //get rid of initialization effects + { + QDeclarativeComponent c(&engine); + c.setData(data, QUrl()); + } + QBENCHMARK { QDeclarativeComponent c(&engine); c.setData(data, QUrl()); diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 1c3332e..83f66de 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #ifdef Q_OS_SYMBIAN @@ -108,6 +109,9 @@ public: tst_creation::tst_creation() { qmlRegisterType("Qt.test", 1, 0, "TestType"); + + //get rid of initialization effects + QDeclarativeTextInput te; } inline QUrl TEST_FILE(const QString &filename) diff --git a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 2d9744e..104746e 100644 --- a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -80,6 +80,12 @@ void tst_qmlgraphicsimage::qmlgraphicsimage_file() { int x = 0; QUrl url(SRCDIR "/image.png"); + //get rid of initialization effects + { + QDeclarativeImage *image = new QDeclarativeImage; + QDeclarativeEngine::setContextForObject(image, engine.rootContext()); + image->setSource(url); + } QBENCHMARK { QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); QDeclarativeImage *image = new QDeclarativeImage; diff --git a/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp b/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp index f4c4c1f..4bab89f 100644 --- a/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp +++ b/tests/benchmarks/declarative/typeimports/tst_typeimports.cpp @@ -126,6 +126,9 @@ void tst_typeimports::cpp() void tst_typeimports::qml() { + //get rid of initialization effects + { QDeclarativeComponent component(&engine, TEST_FILE("qml.qml")); } + QBENCHMARK { QDeclarativeComponent component(&engine, TEST_FILE("qml.qml")); QVERIFY(component.isReady()); -- cgit v0.12