From ef7fd678457496abc0b2d204c816b10a57816907 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Thu, 9 Feb 2012 09:55:09 +0100 Subject: Replace Q_WS_WINCE against Q_OS_WINCE. Window system Macros where deprecated so use Q_OS_WINCE for now. This code will need some refactoring, but this is the first step to it. Change-Id: I5876b80ee45d4b38ac63fc7d51e775dc70bbd485 Reviewed-by: Friedemann Kleint --- tests/benchmarks/corelib/io/qfile/main.cpp | 2 +- tests/benchmarks/corelib/tools/containers-sequential/main.cpp | 2 +- .../benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp | 2 +- tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp | 6 +++--- tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 92edd43060..3d16921b7f 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -542,7 +542,7 @@ void tst_qfile::createSmallFiles() dir.cd("tst"); tmpDirName = dir.absolutePath(); -#if defined(Q_WS_WINCE) +#if defined(Q_OS_WINCE) for (int i = 0; i < 100; ++i) #else for (int i = 0; i < 1000; ++i) diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp index ee13a63a57..e42a40b110 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp @@ -133,7 +133,7 @@ struct Large { // A "large" item type }; // Embedded devices typically have limited memory -#if defined(Q_WS_WINCE) +#if defined(Q_OS_WINCE) # define LARGE_MAX_SIZE 2000 #else # define LARGE_MAX_SIZE 20000 diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index cc549f835d..8eef993c06 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -414,7 +414,7 @@ void tst_QGraphicsView::chipTester_data() void tst_QGraphicsView::chipTester() { -#ifdef Q_WS_WINCE_WM +#ifdef Q_OS_WINCE_WM QSKIP("WinCE WM: Fails on Windows Mobile w/o OpenGL"); #endif QFETCH(bool, antialias); diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index e48172da89..829bba5c5d 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -565,7 +565,7 @@ void tst_qnetworkreply::uploadPerformance() void tst_qnetworkreply::httpUploadPerformance() { -#if defined(Q_WS_WINCE_WM) +#if defined(Q_OS_WINCE_WM) // Show some mercy for non-desktop platform/s enum {UploadSize = 4*1024*1024}; // 4 MB #else @@ -636,7 +636,7 @@ void tst_qnetworkreply::httpDownloadPerformance() { QFETCH(bool, serverSendsContentLength); QFETCH(bool, chunkedEncoding); -#if defined(Q_WS_WINCE_WM) +#if defined(Q_OS_WINCE_WM) // Show some mercy to non-desktop platform/s enum {UploadSize = 4*1024*1024}; // 4 MB #else @@ -720,7 +720,7 @@ void tst_qnetworkreply::httpDownloadPerformanceDownloadBuffer() QFETCH(HttpDownloadPerformanceDownloadBufferTestType, testType); // On my Linux Desktop the results are already visible with 128 kB, however we use this to have good results. -#if defined(Q_WS_WINCE_WM) +#if defined(Q_OS_WINCE_WM) // Show some mercy to non-desktop platform/s enum {UploadSize = 4*1024*1024}; // 4 MB #else diff --git a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp index ea923a7fd0..2bb23e5781 100644 --- a/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp +++ b/tests/benchmarks/network/socket/qtcpserver/tst_qtcpserver.cpp @@ -173,7 +173,7 @@ void tst_QTcpServer::ipv6LoopbackPerformanceTest() QFETCH_GLOBAL(bool, setProxy); if (setProxy) return; -#if defined(Q_WS_WINCE_WM) +#if defined(Q_OS_WINCE_WM) QSKIP("WinCE WM: Not yet supported"); #endif -- cgit v1.2.3 From 3af86043ba27c2720b6d61a9457a6aefa4210efd Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sun, 22 Jan 2012 14:46:13 +0200 Subject: Add a testcase of a list of UUIDs in string form. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UUIDs are a good testcase, because the textual content is all fairly similar. This also changes data generation to be a little neater now that we're starting to get multiple pieces of data. Change-Id: Ie4100a1ca4dbe7bf1cd73de883a9854377ac2f5e Reviewed-by: Giuseppe D'Angelo Reviewed-by: João Abecasis --- tests/benchmarks/corelib/tools/qhash/main.cpp | 36 ++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp index 6f3228d0eb..18138cbd47 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.cpp +++ b/tests/benchmarks/corelib/tools/qhash/main.cpp @@ -45,7 +45,7 @@ #include #include #include - +#include #include @@ -69,12 +69,36 @@ private: void tst_QHash::data() { - QFile smallPathsData("paths_small_data.txt"); - smallPathsData.open(QIODevice::ReadOnly); - QTest::addColumn("items"); - QTest::newRow("paths-small") - << QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n')); + static QStringList smallFilePaths; + + { + // small list of file paths + if (smallFilePaths.isEmpty()) { + QFile smallPathsData("paths_small_data.txt"); + QVERIFY(smallPathsData.open(QIODevice::ReadOnly)); + smallFilePaths = QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n')); + Q_ASSERT(!smallFilePaths.isEmpty()); + } + + QTest::newRow("paths-small") << smallFilePaths; + } + + { + // list of UUIDs + static QStringList uuids; + if (uuids.isEmpty()) { + // guaranteed to be completely random, generated by http://xkcd.com/221/ + QUuid ns = QUuid("{f43d2ef3-2fe9-4563-a6f5-5a0100c2d699}"); + uuids.reserve(smallFilePaths.size()); + + foreach (const QString &path, smallFilePaths) + uuids.append(QUuid::createUuidV5(ns, path).toString()); + } + + QTest::newRow("uuids-list") << uuids; + } + } void tst_QHash::qhash_qt4() -- cgit v1.2.3 From 18965b1384cb3f85dc9e2d9c961c343331e8bd47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 13 Feb 2012 13:01:59 +0100 Subject: Add QMetaType::FirstCoreType enum value. We should not assume that the first type id is 0. Change-Id: I17ba6ba57e97ebd495904bfd11235fe458f214e5 Reviewed-by: Kent Hansen --- tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp | 2 +- tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp index 14895863e4..1c5dc9227f 100644 --- a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -240,7 +240,7 @@ void tst_QMetaType::isRegisteredNotRegistered() void tst_QMetaType::constructCoreType_data() { QTest::addColumn("typeId"); - for (int i = 0; i <= QMetaType::LastCoreType; ++i) + for (int i = QMetaType::FirstCoreType; i <= QMetaType::LastCoreType; ++i) QTest::newRow(QMetaType::typeName(i)) << i; // GUI types are tested in tst_QGuiMetaType. } diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp index 0c4af17376..e842e18d52 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp @@ -305,7 +305,7 @@ void tst_qvariant::stringVariantValue() void tst_qvariant::createCoreType_data() { QTest::addColumn("typeId"); - for (int i = 0; i <= QMetaType::LastCoreType; ++i) + for (int i = QMetaType::FirstCoreType; i <= QMetaType::LastCoreType; ++i) QTest::newRow(QMetaType::typeName(i)) << i; } -- cgit v1.2.3 From 214e031d56714ba69ef929f1e763e243b393e460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 20 Dec 2011 17:11:46 +0100 Subject: Implement new static less API for QMetaType. Currently QMetaType API contains almost only static methods. This works nice until someone needs more information or needs to do more operations on a type. In this case every function call has to do type dispatch. This API allows to avoid redundant type dispatching, by caching a type information in a QMetaType instance. It gives significant performance boost especially for custom types (up to 9x). Change-Id: I223d066268402e072e41ca1d0a3e7bc160655d7f Reviewed-by: Stephen Kelly Reviewed-by: Bradley T. Hughes --- .../corelib/kernel/qmetatype/tst_qmetatype.cpp | 54 +++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp index 1c5dc9227f..a3cdd38e56 100644 --- a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -72,6 +72,8 @@ private slots: void constructCoreType_data(); void constructCoreType(); + void constructCoreTypeStaticLess_data(); + void constructCoreTypeStaticLess(); void constructCoreTypeCopy_data(); void constructCoreTypeCopy(); @@ -79,6 +81,8 @@ private slots: void constructInPlace(); void constructInPlaceCopy_data(); void constructInPlaceCopy(); + void constructInPlaceCopyStaticLess_data(); + void constructInPlaceCopyStaticLess(); }; tst_QMetaType::tst_QMetaType() @@ -89,6 +93,12 @@ tst_QMetaType::~tst_QMetaType() { } +struct BigClass +{ + double n,i,e,r,o,b; +}; +Q_DECLARE_METATYPE(BigClass); + void tst_QMetaType::typeBuiltin_data() { QTest::addColumn("typeName"); @@ -260,6 +270,23 @@ void tst_QMetaType::constructCoreType() } } +void tst_QMetaType::constructCoreTypeStaticLess_data() +{ + constructCoreType_data(); +} + +void tst_QMetaType::constructCoreTypeStaticLess() +{ + QFETCH(int, typeId); + QBENCHMARK { + QMetaType type(typeId); + for (int i = 0; i < 100000; ++i) { + void *data = type.create((void *)0); + type.destroy(data); + } + } +} + void tst_QMetaType::constructCoreTypeCopy_data() { constructCoreType_data(); @@ -285,6 +312,7 @@ void tst_QMetaType::constructCoreTypeCopy() void tst_QMetaType::constructInPlace_data() { constructCoreType_data(); + QTest::newRow("custom") << qMetaTypeId(); } void tst_QMetaType::constructInPlace() @@ -305,7 +333,7 @@ void tst_QMetaType::constructInPlace() void tst_QMetaType::constructInPlaceCopy_data() { - constructCoreType_data(); + constructInPlace_data(); } void tst_QMetaType::constructInPlaceCopy() @@ -326,5 +354,29 @@ void tst_QMetaType::constructInPlaceCopy() qFreeAligned(storage); } +void tst_QMetaType::constructInPlaceCopyStaticLess_data() +{ + constructInPlaceCopy_data(); +} + +void tst_QMetaType::constructInPlaceCopyStaticLess() +{ + QFETCH(int, typeId); + int size = QMetaType::sizeOf(typeId); + void *storage = qMallocAligned(size, 2 * sizeof(qlonglong)); + void *other = QMetaType::create(typeId); + QCOMPARE(QMetaType::construct(typeId, storage, other), storage); + QMetaType::destruct(typeId, storage); + QBENCHMARK { + QMetaType type(typeId); + for (int i = 0; i < 100000; ++i) { + type.construct(storage, other); + type.destruct(storage); + } + } + QMetaType::destroy(typeId, other); + qFreeAligned(storage); +} + QTEST_MAIN(tst_QMetaType) #include "tst_qmetatype.moc" -- cgit v1.2.3 From 1b23336a297681dc12700880540a5a8d31f146fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Mon, 9 Jan 2012 11:36:03 +0100 Subject: Use static-less QMetaType API in QVariant. This patch improves performance when constructing a custom type in a QVariant by ~ 7-20% (instructions count) depending on the type size and metatype attributes. Change-Id: Ic2707ff5abd689b66e23c1794f111504bf9b3b01 Reviewed-by: Stephen Kelly --- tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/benchmarks') diff --git a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp index e842e18d52..f6b4d88311 100644 --- a/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/benchmarks/corelib/kernel/qvariant/tst_qvariant.cpp @@ -90,6 +90,7 @@ struct BigClass double n,i,e,r,o,b; }; Q_STATIC_ASSERT(sizeof(BigClass) > sizeof(QVariant::Private::Data)); +Q_DECLARE_TYPEINFO(BigClass, Q_MOVABLE_TYPE); Q_DECLARE_METATYPE(BigClass); struct SmallClass @@ -97,6 +98,7 @@ struct SmallClass char s; }; Q_STATIC_ASSERT(sizeof(SmallClass) <= sizeof(QVariant::Private::Data)); +Q_DECLARE_TYPEINFO(SmallClass, Q_MOVABLE_TYPE); Q_DECLARE_METATYPE(SmallClass); void tst_qvariant::testBound() -- cgit v1.2.3