From 8060dd3c42982543b2b5949187fa5b5bb6aeff29 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Wed, 18 Jan 2012 18:02:24 +0200 Subject: Add a string hash implementation similar to the one in Java. This uses a similar runtime to the approach of sampling part of the string, with the benefit that it doesn't reduce the sampling to subsections of the string. Ironically, Java used to only sample parts of the string as well, but found that it produced too many collisions with certain string types, so they moved to use this method. RESULT : tst_QHash::qhash_qt4(): 0.0537 msecs per iteration (total: 110, iterations: 2048) PASS : tst_QHash::qhash_qt4() RESULT : tst_QHash::qhash_faster(): 0.015 msecs per iteration (total: 62, iterations: 4096) PASS : tst_QHash::qhash_faster() RESULT : tst_QHash::javaString(): 0.016 msecs per iteration (total: 66, iterations: 4096) Change-Id: Icb5da341ab6445163f4217650a0bdb3903e50210 Reviewed-by: hjk --- tests/benchmarks/corelib/tools/qhash/outofline.cpp | 13 +++++++++++++ tests/benchmarks/corelib/tools/qhash/qhash_string.cpp | 16 ++++++++++++++++ tests/benchmarks/corelib/tools/qhash/qhash_string.h | 12 ++++++++++++ 3 files changed, 41 insertions(+) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp index 11a5f9e733..86e92e1630 100644 --- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp @@ -87,4 +87,17 @@ uint qHash(const String &str) return h; } +uint qHash(const JavaString &str) +{ + const unsigned short *p = (unsigned short *)str.constData(); + const int len = str.size(); + + uint h = 0; + + for (int i = 0; i < len; ++i) + h = 31 * h + p[i]; + + return h; +} + QT_END_NAMESPACE diff --git a/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp b/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp index 874a0c543a..4ed5a78a32 100644 --- a/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp +++ b/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp @@ -83,6 +83,7 @@ class tst_QHash : public QObject private slots: void qhash_qt4(); void qhash_faster(); + void javaString(); private: QString data(); @@ -126,6 +127,21 @@ void tst_QHash::qhash_faster() } } +void tst_QHash::javaString() +{ + QList items; + foreach (const QString &s, data().split(QLatin1Char('\n'))) + items.append(s); + QHash hash; + + QBENCHMARK { + for (int i = 0, n = items.size(); i != n; ++i) { + hash[items.at(i)] = i; + } + } +} + + QTEST_MAIN(tst_QHash) #include "qhash_string.moc" diff --git a/tests/benchmarks/corelib/tools/qhash/qhash_string.h b/tests/benchmarks/corelib/tools/qhash/qhash_string.h index 94f142914b..3b2237e0b9 100644 --- a/tests/benchmarks/corelib/tools/qhash/qhash_string.h +++ b/tests/benchmarks/corelib/tools/qhash/qhash_string.h @@ -50,3 +50,15 @@ struct String : QString QT_BEGIN_NAMESPACE uint qHash(const String &); QT_END_NAMESPACE + + +struct JavaString : QString +{ + JavaString() {} + JavaString(const QString &s) : QString(s) {} +}; + +QT_BEGIN_NAMESPACE +uint qHash(const JavaString &); +QT_END_NAMESPACE + -- cgit v1.2.3 From 4ed85ba43fa50adacc4e47da6b5e70bad6f03d2e Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sat, 21 Jan 2012 13:45:44 +0200 Subject: Introduce a qalgorithms benchmark. Based on the unit test for data production. Change-Id: I88a411c0079b251d3682c3fbf9fe7ed1b5457a7e Reviewed-by: Anselmo L. S. Melo Reviewed-by: Richard J. Moore --- .../corelib/tools/qalgorithms/.gitignore | 1 + .../corelib/tools/qalgorithms/qalgorithms.pro | 4 + .../corelib/tools/qalgorithms/tst_qalgorithms.cpp | 140 +++++++++++++++++++++ tests/benchmarks/corelib/tools/tools.pro | 3 +- 4 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 tests/benchmarks/corelib/tools/qalgorithms/.gitignore create mode 100644 tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro create mode 100644 tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qalgorithms/.gitignore b/tests/benchmarks/corelib/tools/qalgorithms/.gitignore new file mode 100644 index 0000000000..379c13eb9b --- /dev/null +++ b/tests/benchmarks/corelib/tools/qalgorithms/.gitignore @@ -0,0 +1 @@ +tst_qalgorithms diff --git a/tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro b/tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro new file mode 100644 index 0000000000..0e6e830185 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro @@ -0,0 +1,4 @@ +CONFIG += testcase +TARGET = tst_qalgorithms +QT = core testlib +SOURCES = tst_qalgorithms.cpp diff --git a/tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp new file mode 100644 index 0000000000..751c3e3ae4 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2012 Robin Burchell +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +class tst_QAlgorithms : public QObject +{ + Q_OBJECT +private slots: + void stableSort_data(); + void stableSort(); + + void sort_data(); + void sort(); +}; + +template +QVector generateData(QString dataSetType, const int length) +{ + QVector container; + if (dataSetType == "Random") { + for (int i = 0; i < length; ++i) + container.append(rand()); + } else if (dataSetType == "Ascending") { + for (int i = 0; i < length; ++i) + container.append(i); + } else if (dataSetType == "Descending") { + for (int i = 0; i < length; ++i) + container.append(length - i); + } else if (dataSetType == "Equal") { + for (int i = 0; i < length; ++i) + container.append(43); + } else if (dataSetType == "Duplicates") { + for (int i = 0; i < length; ++i) + container.append(i % 10); + } else if (dataSetType == "Almost Sorted") { + for (int i = 0; i < length; ++i) + container.append(i); + for (int i = 0; i<= length / 10; ++i) { + const int iswap = i * 9; + DataType tmp = container.at(iswap); + container[iswap] = container.at(iswap + 1); + container[iswap + 1] = tmp; + } + } + + return container; +} + +Q_DECLARE_METATYPE(QVector) + +void tst_QAlgorithms::stableSort_data() +{ + const int dataSize = 5000; + QTest::addColumn >("unsorted"); + QTest::newRow("Equal") << (generateData("Equal", dataSize)); + QTest::newRow("Ascending") << (generateData("Ascending", dataSize)); + QTest::newRow("Descending") << (generateData("Descending", dataSize)); + QTest::newRow("Duplicates") << (generateData("Duplicates", dataSize)); + QTest::newRow("Almost Sorted") << (generateData("Almost Sorted", dataSize)); +} + +void tst_QAlgorithms::stableSort() +{ + QFETCH(QVector, unsorted); + + QBENCHMARK { + QVector sorted = unsorted; + qStableSort(sorted.begin(), sorted.end()); + } +} + +void tst_QAlgorithms::sort_data() +{ + stableSort_data(); +} + +void tst_QAlgorithms::sort() +{ + QFETCH(QVector, unsorted); + + QBENCHMARK { + QVector sorted = unsorted; + qSort(sorted.begin(), sorted.end()); + } +} + + +QTEST_MAIN(tst_QAlgorithms) +#include "tst_qalgorithms.moc" + diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro index d5bf8301f9..ea9059e759 100644 --- a/tests/benchmarks/corelib/tools/tools.pro +++ b/tests/benchmarks/corelib/tools/tools.pro @@ -10,6 +10,7 @@ SUBDIRS = \ qstring \ qstringbuilder \ qstringlist \ - qvector + qvector \ + qalgorithms !*g++*: SUBDIRS -= qstring -- cgit v1.2.3 From 629d6eda5cf67122776981de9073857bbc3dcba2 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 20 Jan 2012 13:06:31 +1000 Subject: Update contact information in license headers. Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern --- tests/benchmarks/corelib/tools/containers-associative/main.cpp | 2 +- tests/benchmarks/corelib/tools/containers-sequential/main.cpp | 2 +- tests/benchmarks/corelib/tools/qbytearray/main.cpp | 2 +- tests/benchmarks/corelib/tools/qchar/main.cpp | 2 +- tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp | 2 +- tests/benchmarks/corelib/tools/qhash/outofline.cpp | 2 +- tests/benchmarks/corelib/tools/qhash/qhash_string.cpp | 2 +- tests/benchmarks/corelib/tools/qhash/qhash_string.h | 2 +- tests/benchmarks/corelib/tools/qlist/main.cpp | 2 +- tests/benchmarks/corelib/tools/qrect/main.cpp | 2 +- tests/benchmarks/corelib/tools/qregexp/main.cpp | 2 +- tests/benchmarks/corelib/tools/qstring/data.h | 2 +- tests/benchmarks/corelib/tools/qstring/generatelist.pl | 2 +- tests/benchmarks/corelib/tools/qstring/generatelist_char.pl | 2 +- tests/benchmarks/corelib/tools/qstring/main.cpp | 2 +- tests/benchmarks/corelib/tools/qstringbuilder/main.cpp | 2 +- tests/benchmarks/corelib/tools/qstringlist/main.cpp | 2 +- tests/benchmarks/corelib/tools/qvector/main.cpp | 2 +- tests/benchmarks/corelib/tools/qvector/outofline.cpp | 2 +- tests/benchmarks/corelib/tools/qvector/qrawvector.h | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/main.cpp index 3e9dfe3568..c38e1fe492 100644 --- a/tests/benchmarks/corelib/tools/containers-associative/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-associative/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp index ae05a164a2..57fc455e4a 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qbytearray/main.cpp b/tests/benchmarks/corelib/tools/qbytearray/main.cpp index 61a7855884..64131f0b2d 100644 --- a/tests/benchmarks/corelib/tools/qbytearray/main.cpp +++ b/tests/benchmarks/corelib/tools/qbytearray/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qchar/main.cpp b/tests/benchmarks/corelib/tools/qchar/main.cpp index 3abf7584bb..431fd29f55 100644 --- a/tests/benchmarks/corelib/tools/qchar/main.cpp +++ b/tests/benchmarks/corelib/tools/qchar/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp b/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp index b6b064e012..13cc487112 100644 --- a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp +++ b/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp index 86e92e1630..5f067da2e1 100644 --- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtTest module of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp b/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp index 4ed5a78a32..36e9f41cb7 100644 --- a/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp +++ b/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qhash/qhash_string.h b/tests/benchmarks/corelib/tools/qhash/qhash_string.h index 3b2237e0b9..cd2dea576f 100644 --- a/tests/benchmarks/corelib/tools/qhash/qhash_string.h +++ b/tests/benchmarks/corelib/tools/qhash/qhash_string.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtTest module of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qlist/main.cpp b/tests/benchmarks/corelib/tools/qlist/main.cpp index d3380b188c..d92da1ca3a 100644 --- a/tests/benchmarks/corelib/tools/qlist/main.cpp +++ b/tests/benchmarks/corelib/tools/qlist/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qrect/main.cpp b/tests/benchmarks/corelib/tools/qrect/main.cpp index 59174e4f08..e24f6b9e18 100644 --- a/tests/benchmarks/corelib/tools/qrect/main.cpp +++ b/tests/benchmarks/corelib/tools/qrect/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qregexp/main.cpp b/tests/benchmarks/corelib/tools/qregexp/main.cpp index 32e8e72577..f9f517994c 100644 --- a/tests/benchmarks/corelib/tools/qregexp/main.cpp +++ b/tests/benchmarks/corelib/tools/qregexp/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qstring/data.h b/tests/benchmarks/corelib/tools/qstring/data.h index 925ce3663a..a62f128c93 100644 --- a/tests/benchmarks/corelib/tools/qstring/data.h +++ b/tests/benchmarks/corelib/tools/qstring/data.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist.pl b/tests/benchmarks/corelib/tools/qstring/generatelist.pl index 1f10b638b2..a933f5a326 100644 --- a/tests/benchmarks/corelib/tools/qstring/generatelist.pl +++ b/tests/benchmarks/corelib/tools/qstring/generatelist.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. -## Contact: Nokia Corporation (qt-info@nokia.com) +## Contact: http://www.qt-project.org/ ## ## This file is part of the QtCore module of the Qt Toolkit. ## diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl b/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl index ad6595ab5c..6de5eb08ec 100644 --- a/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl +++ b/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl @@ -2,7 +2,7 @@ # -*- mode: utf-8; tabs: nil -*- ## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. -## Contact: Nokia Corporation (qt-info@nokia.com) +## Contact: http://www.qt-project.org/ ## ## This file is part of the QtCore module of the Qt Toolkit. ## diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index ab23fa5f9b..be2abe5c51 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp index b1ec5dace8..c224dd8ce4 100644 --- a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp +++ b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite module of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qstringlist/main.cpp b/tests/benchmarks/corelib/tools/qstringlist/main.cpp index 696f0fc6da..00099e976a 100644 --- a/tests/benchmarks/corelib/tools/qstringlist/main.cpp +++ b/tests/benchmarks/corelib/tools/qstringlist/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qvector/main.cpp b/tests/benchmarks/corelib/tools/qvector/main.cpp index 38c1f4ac46..3911def018 100644 --- a/tests/benchmarks/corelib/tools/qvector/main.cpp +++ b/tests/benchmarks/corelib/tools/qvector/main.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qvector/outofline.cpp b/tests/benchmarks/corelib/tools/qvector/outofline.cpp index a30a7e786a..6e3ea68baf 100644 --- a/tests/benchmarks/corelib/tools/qvector/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qvector/outofline.cpp @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtTest module of the Qt Toolkit. ** diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h index 14fe9ca6c1..79d2c26700 100644 --- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h +++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h @@ -2,7 +2,7 @@ ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. ** -- cgit v1.2.3 From f61112aa323747714e9a644095b2c5b946bb8179 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 20 Jan 2012 01:27:46 +0200 Subject: Move test files around. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main.cpp is easier for my muscle memory to remember than qhash_string as it is used by a number of other tests. Change-Id: I044f995d55a4ff1328dde0ae27b6e36a80114c38 Reviewed-by: Richard J. Moore Reviewed-by: João Abecasis --- tests/benchmarks/corelib/tools/qhash/main.cpp | 147 +++++++++++++++++++++ tests/benchmarks/corelib/tools/qhash/main.h | 64 +++++++++ tests/benchmarks/corelib/tools/qhash/outofline.cpp | 2 +- tests/benchmarks/corelib/tools/qhash/qhash.pro | 2 +- .../corelib/tools/qhash/qhash_string.cpp | 147 --------------------- .../benchmarks/corelib/tools/qhash/qhash_string.h | 64 --------- 6 files changed, 213 insertions(+), 213 deletions(-) create mode 100644 tests/benchmarks/corelib/tools/qhash/main.cpp create mode 100644 tests/benchmarks/corelib/tools/qhash/main.h delete mode 100644 tests/benchmarks/corelib/tools/qhash/qhash_string.cpp delete mode 100644 tests/benchmarks/corelib/tools/qhash/qhash_string.h (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp new file mode 100644 index 0000000000..463f16393a --- /dev/null +++ b/tests/benchmarks/corelib/tools/qhash/main.cpp @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + +//////////////////////////////////////////////////////////////////// + +This benchmark serves as reality check on the idea that hashing the complete +string is a good idea. + + Executive summary: It is not a good idea. + +//////////////////////////////////////////////////////////////////// + +********* Start testing of tst_QHash ********* +Config: Using QTest library 5.0.0, Qt 5.0.0 +PASS : tst_QHash::initTestCase() +RESULT : tst_QHash::qhash_qt4(): + 0.041 msecs per iteration (total: 85, iterations: 2048) +PASS : tst_QHash::qhash_qt4() +RESULT : tst_QHash::qhash_faster(): + 0.0122 msecs per iteration (total: 100, iterations: 8192) +PASS : tst_QHash::qhash_faster() +PASS : tst_QHash::cleanupTestCase() +Totals: 4 passed, 0 failed, 0 skipped + +//////////////////////////////////////////////////////////////////// + +*/ + +#include "main.h" + +#include +#include +#include +#include + +#include + + +class tst_QHash : public QObject +{ + Q_OBJECT + +private slots: + void qhash_qt4(); + void qhash_faster(); + void javaString(); + +private: + QString data(); +}; + +const int N = 1000000; +extern double s; + +///////////////////// QHash ///////////////////// + +QString tst_QHash::data() +{ + QFile file("data.txt"); + file.open(QIODevice::ReadOnly); + return QString::fromLatin1(file.readAll()); +} + +void tst_QHash::qhash_qt4() +{ + QStringList items = data().split(QLatin1Char('\n')); + QHash hash; + + QBENCHMARK { + for (int i = 0, n = items.size(); i != n; ++i) { + hash[items.at(i)] = i; + } + } +} + +void tst_QHash::qhash_faster() +{ + QList items; + foreach (const QString &s, data().split(QLatin1Char('\n'))) + items.append(s); + QHash hash; + + QBENCHMARK { + for (int i = 0, n = items.size(); i != n; ++i) { + hash[items.at(i)] = i; + } + } +} + +void tst_QHash::javaString() +{ + QList items; + foreach (const QString &s, data().split(QLatin1Char('\n'))) + items.append(s); + QHash hash; + + QBENCHMARK { + for (int i = 0, n = items.size(); i != n; ++i) { + hash[items.at(i)] = i; + } + } +} + + +QTEST_MAIN(tst_QHash) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qhash/main.h b/tests/benchmarks/corelib/tools/qhash/main.h new file mode 100644 index 0000000000..cd2dea576f --- /dev/null +++ b/tests/benchmarks/corelib/tools/qhash/main.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +struct String : QString +{ + String() {} + String(const QString &s) : QString(s) {} +}; + +QT_BEGIN_NAMESPACE +uint qHash(const String &); +QT_END_NAMESPACE + + +struct JavaString : QString +{ + JavaString() {} + JavaString(const QString &s) : QString(s) {} +}; + +QT_BEGIN_NAMESPACE +uint qHash(const JavaString &); +QT_END_NAMESPACE + diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp index 5f067da2e1..88fd9c144d 100644 --- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qhash_string.h" +#include "main.h" static void doHash(const unsigned short *p, uint &h) { diff --git a/tests/benchmarks/corelib/tools/qhash/qhash.pro b/tests/benchmarks/corelib/tools/qhash/qhash.pro index 51d3e7f253..40f661c116 100644 --- a/tests/benchmarks/corelib/tools/qhash/qhash.pro +++ b/tests/benchmarks/corelib/tools/qhash/qhash.pro @@ -1,5 +1,5 @@ TARGET = tst_hash QT = core testlib INCLUDEPATH += . -SOURCES += qhash_string.cpp outofline.cpp +SOURCES += main.cpp outofline.cpp CONFIG += release diff --git a/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp b/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp deleted file mode 100644 index 36e9f41cb7..0000000000 --- a/tests/benchmarks/corelib/tools/qhash/qhash_string.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - -//////////////////////////////////////////////////////////////////// - -This benchmark serves as reality check on the idea that hashing the complete -string is a good idea. - - Executive summary: It is not a good idea. - -//////////////////////////////////////////////////////////////////// - -********* Start testing of tst_QHash ********* -Config: Using QTest library 5.0.0, Qt 5.0.0 -PASS : tst_QHash::initTestCase() -RESULT : tst_QHash::qhash_qt4(): - 0.041 msecs per iteration (total: 85, iterations: 2048) -PASS : tst_QHash::qhash_qt4() -RESULT : tst_QHash::qhash_faster(): - 0.0122 msecs per iteration (total: 100, iterations: 8192) -PASS : tst_QHash::qhash_faster() -PASS : tst_QHash::cleanupTestCase() -Totals: 4 passed, 0 failed, 0 skipped - -//////////////////////////////////////////////////////////////////// - -*/ - -#include "qhash_string.h" - -#include -#include -#include -#include - -#include - - -class tst_QHash : public QObject -{ - Q_OBJECT - -private slots: - void qhash_qt4(); - void qhash_faster(); - void javaString(); - -private: - QString data(); -}; - -const int N = 1000000; -extern double s; - -///////////////////// QHash ///////////////////// - -QString tst_QHash::data() -{ - QFile file("data.txt"); - file.open(QIODevice::ReadOnly); - return QString::fromLatin1(file.readAll()); -} - -void tst_QHash::qhash_qt4() -{ - QStringList items = data().split(QLatin1Char('\n')); - QHash hash; - - QBENCHMARK { - for (int i = 0, n = items.size(); i != n; ++i) { - hash[items.at(i)] = i; - } - } -} - -void tst_QHash::qhash_faster() -{ - QList items; - foreach (const QString &s, data().split(QLatin1Char('\n'))) - items.append(s); - QHash hash; - - QBENCHMARK { - for (int i = 0, n = items.size(); i != n; ++i) { - hash[items.at(i)] = i; - } - } -} - -void tst_QHash::javaString() -{ - QList items; - foreach (const QString &s, data().split(QLatin1Char('\n'))) - items.append(s); - QHash hash; - - QBENCHMARK { - for (int i = 0, n = items.size(); i != n; ++i) { - hash[items.at(i)] = i; - } - } -} - - -QTEST_MAIN(tst_QHash) - -#include "qhash_string.moc" diff --git a/tests/benchmarks/corelib/tools/qhash/qhash_string.h b/tests/benchmarks/corelib/tools/qhash/qhash_string.h deleted file mode 100644 index cd2dea576f..0000000000 --- a/tests/benchmarks/corelib/tools/qhash/qhash_string.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtTest module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -struct String : QString -{ - String() {} - String(const QString &s) : QString(s) {} -}; - -QT_BEGIN_NAMESPACE -uint qHash(const String &); -QT_END_NAMESPACE - - -struct JavaString : QString -{ - JavaString() {} - JavaString(const QString &s) : QString(s) {} -}; - -QT_BEGIN_NAMESPACE -uint qHash(const JavaString &); -QT_END_NAMESPACE - -- cgit v1.2.3 From 47d0813f5b3b7df56a3ac4b32c460d82b425c664 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 20 Jan 2012 01:28:46 +0200 Subject: Remove executive summary. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It isn't necessarily that hashing the whole string is the main problem, as the recently added java string benchmark appears to show, which means the original purpose of this benchmark is rather voided. This removal allows gradually repurposing the test towards providing general benchmarks of QHash performance. Change-Id: Iaab0a3b493387dcce99240632342235ed9c44d88 Reviewed-by: João Abecasis --- tests/benchmarks/corelib/tools/qhash/main.cpp | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp index 463f16393a..412f071a99 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.cpp +++ b/tests/benchmarks/corelib/tools/qhash/main.cpp @@ -39,33 +39,6 @@ ** ****************************************************************************/ -/* - -//////////////////////////////////////////////////////////////////// - -This benchmark serves as reality check on the idea that hashing the complete -string is a good idea. - - Executive summary: It is not a good idea. - -//////////////////////////////////////////////////////////////////// - -********* Start testing of tst_QHash ********* -Config: Using QTest library 5.0.0, Qt 5.0.0 -PASS : tst_QHash::initTestCase() -RESULT : tst_QHash::qhash_qt4(): - 0.041 msecs per iteration (total: 85, iterations: 2048) -PASS : tst_QHash::qhash_qt4() -RESULT : tst_QHash::qhash_faster(): - 0.0122 msecs per iteration (total: 100, iterations: 8192) -PASS : tst_QHash::qhash_faster() -PASS : tst_QHash::cleanupTestCase() -Totals: 4 passed, 0 failed, 0 skipped - -//////////////////////////////////////////////////////////////////// - -*/ - #include "main.h" #include -- cgit v1.2.3 From 1806ea8dd9c5849ea70389d5c3baf66137242d8e Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Fri, 20 Jan 2012 01:54:43 +0200 Subject: Add the capability to use multiple data sources for qhash benchmark. More data sources to be added in followup commits. Change-Id: I0393119b36ac5d88fc2c5c8d46b000d13d5ca996 Reviewed-by: Richard J. Moore --- tests/benchmarks/corelib/tools/qhash/data.txt | 195 --------------------- tests/benchmarks/corelib/tools/qhash/main.cpp | 51 +++--- .../corelib/tools/qhash/paths_small_data.txt | 195 +++++++++++++++++++++ 3 files changed, 226 insertions(+), 215 deletions(-) delete mode 100644 tests/benchmarks/corelib/tools/qhash/data.txt create mode 100644 tests/benchmarks/corelib/tools/qhash/paths_small_data.txt (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qhash/data.txt b/tests/benchmarks/corelib/tools/qhash/data.txt deleted file mode 100644 index d5acd28820..0000000000 --- a/tests/benchmarks/corelib/tools/qhash/data.txt +++ /dev/null @@ -1,195 +0,0 @@ -. -./corelib.pro -./kernel -./kernel/kernel.pro -./kernel/qobject -./kernel/qobject/main.cpp -./kernel/qobject/object.cpp -./kernel/qobject/object.h -./kernel/qobject/Makefile -./kernel/qobject/qobject.pro -./kernel/qvariant -./kernel/qvariant/tst_qvariant.cpp -./kernel/qvariant/Makefile -./kernel/qvariant/qvariant.pro -./kernel/qtimer_vs_qmetaobject -./kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp -./kernel/qtimer_vs_qmetaobject/Makefile -./kernel/qtimer_vs_qmetaobject/qtimer_vs_qmetaobject.pro -./kernel/.pch -./kernel/.pch/debug-shared -./kernel/qmetaobject -./kernel/qmetaobject/main.cpp -./kernel/qmetaobject/qmetaobject.pro -./kernel/qmetaobject/Makefile -./kernel/Makefile -./kernel/.obj -./kernel/.obj/debug-shared -./kernel/events -./kernel/events/events.pro -./kernel/events/main.cpp -./kernel/events/Makefile -./kernel/qmetatype -./kernel/qmetatype/qmetatype.pro -./kernel/qmetatype/Makefile -./kernel/qmetatype/tst_qmetatype.cpp -./codecs -./codecs/qtextcodec -./codecs/qtextcodec/qtextcodec.pro -./codecs/qtextcodec/main.cpp -./codecs/qtextcodec/Makefile -./codecs/qtextcodec/utf-8.txt -./codecs/codecs.pro -./codecs/.pch -./codecs/.pch/debug-shared -./codecs/Makefile -./codecs/.obj -./codecs/.obj/debug-shared -./.pch -./.pch/debug-shared -./tools -./tools/tools.pro -./tools/qregexp -./tools/qregexp/qregexp.qrc -./tools/qregexp/main.cpp -./tools/qregexp/Makefile -./tools/qregexp/qregexp.pro -./tools/qvector -./tools/qvector/tst_vector -./tools/qvector/.pch -./tools/qvector/.pch/debug-shared -./tools/qvector/qrawvector.h -./tools/qvector/main.cpp -./tools/qvector/Makefile -./tools/qvector/.moc -./tools/qvector/.moc/release-shared -./tools/qvector/.moc/release-shared/main.moc -./tools/qvector/.obj -./tools/qvector/.obj/release-shared -./tools/qvector/.obj/release-shared/outofline.o -./tools/qvector/.obj/release-shared/main.o -./tools/qvector/outofline.cpp -./tools/qvector/qvector.pro -./tools/.pch -./tools/.pch/debug-shared -./tools/qstringbuilder -./tools/qstringbuilder/main.cpp -./tools/qstringbuilder/Makefile -./tools/qstringbuilder/qstringbuilder.pro -./tools/containers-sequential -./tools/containers-sequential/containers-sequential.pro -./tools/containers-sequential/main.cpp -./tools/containers-sequential/Makefile -./tools/qstring -./tools/qstring/generatelist.pl -./tools/qstring/data.h -./tools/qstring/qstring.pro -./tools/qstring/main.cpp -./tools/qstring/data.cpp -./tools/qstring/Makefile -./tools/qstring/utf-8.txt -./tools/qstringlist -./tools/qstringlist/qstringlist.pro -./tools/qstringlist/main.cpp -./tools/qstringlist/.gitignore -./tools/qstringlist/Makefile -./tools/qbytearray -./tools/qbytearray/qbytearray.pro -./tools/qbytearray/main.cpp -./tools/qbytearray/Makefile -./tools/containers-associative -./tools/containers-associative/containers-associative.pro -./tools/containers-associative/main.cpp -./tools/containers-associative/Makefile -./tools/qrect -./tools/qrect/main.cpp -./tools/qrect/Makefile -./tools/qrect/qrect.pro -./tools/Makefile -./tools/qhash -./tools/qhash/data.txt -./tools/qhash/qhash_string.cpp -./tools/qhash/.qhash_string.cpp.swp -./tools/qhash/qhash.pro -./tools/qhash/outofline.cpp -./tools/.obj -./tools/.obj/debug-shared -./Makefile -./.obj -./.obj/debug-shared -./plugin -./plugin/plugin.pro -./plugin/.pch -./plugin/.pch/debug-shared -./plugin/Makefile -./plugin/.obj -./plugin/.obj/debug-shared -./plugin/quuid -./plugin/quuid/tst_quuid.cpp -./plugin/quuid/quuid.pro -./plugin/quuid/Makefile -./io -./io/qtemporaryfile -./io/qtemporaryfile/qtemporaryfile.pro -./io/qtemporaryfile/main.cpp -./io/qtemporaryfile/Makefile -./io/qiodevice -./io/qiodevice/qiodevice.pro -./io/qiodevice/main.cpp -./io/qiodevice/Makefile -./io/qurl -./io/qurl/main.cpp -./io/qurl/Makefile -./io/qurl/qurl.pro -./io/qdir -./io/qdir/.pch -./io/qdir/.pch/debug-shared -./io/qdir/qdir.pro -./io/qdir/tree -./io/qdir/tree/bench_qdir_tree.qrc -./io/qdir/tree/tree.pro -./io/qdir/tree/4.6.0-list.txt -./io/qdir/tree/Makefile -./io/qdir/tree/bench_qdir_tree.cpp -./io/qdir/Makefile -./io/qdir/.obj -./io/qdir/.obj/debug-shared -./io/qdir/10000 -./io/qdir/10000/10000.pro -./io/qdir/10000/bench_qdir_10000.cpp -./io/qdir/10000/Makefile -./io/.pch -./io/.pch/debug-shared -./io/qfile -./io/qfile/qfile.pro -./io/qfile/main.cpp -./io/qfile/Makefile -./io/io.pro -./io/qfileinfo -./io/qfileinfo/qfileinfo.pro -./io/qfileinfo/main.cpp -./io/qfileinfo/Makefile -./io/qdiriterator -./io/qdiriterator/qfilesystemiterator.h -./io/qdiriterator/main.cpp -./io/qdiriterator/Makefile -./io/qdiriterator/qfilesystemiterator.cpp -./io/qdiriterator/qdiriterator.pro -./io/Makefile -./io/.obj -./io/.obj/debug-shared -./thread -./thread/qmutex -./thread/qmutex/tst_qmutex.cpp -./thread/qmutex/Makefile -./thread/qmutex/qmutex.pro -./thread/qthreadstorage -./thread/qthreadstorage/qthreadstorage.pro -./thread/qthreadstorage/Makefile -./thread/qthreadstorage/tst_qthreadstorage.cpp -./thread/.pch -./thread/.pch/debug-shared -./thread/Makefile -./thread/.obj -./thread/.obj/debug-shared -./thread/thread.pro diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp index 412f071a99..f9aec58485 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.cpp +++ b/tests/benchmarks/corelib/tools/qhash/main.cpp @@ -54,12 +54,15 @@ class tst_QHash : public QObject Q_OBJECT private slots: + void qhash_qt4_data() { data(); } void qhash_qt4(); + void qhash_faster_data() { data(); } void qhash_faster(); + void javaString_data() { data(); } void javaString(); private: - QString data(); + void data(); }; const int N = 1000000; @@ -67,49 +70,57 @@ extern double s; ///////////////////// QHash ///////////////////// -QString tst_QHash::data() +void tst_QHash::data() { - QFile file("data.txt"); - file.open(QIODevice::ReadOnly); - return QString::fromLatin1(file.readAll()); + QFile smallPathsData("paths_small_data.txt"); + smallPathsData.open(QIODevice::ReadOnly); + + QTest::addColumn("items"); + QTest::newRow("paths-small") + << QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n')); } void tst_QHash::qhash_qt4() { - QStringList items = data().split(QLatin1Char('\n')); + QFETCH(QStringList, items); + QStringList realitems = items; // for copy/paste ease between benchmarks QHash hash; - + QBENCHMARK { - for (int i = 0, n = items.size(); i != n; ++i) { - hash[items.at(i)] = i; + for (int i = 0, n = realitems.size(); i != n; ++i) { + hash[realitems.at(i)] = i; } } } void tst_QHash::qhash_faster() { - QList items; - foreach (const QString &s, data().split(QLatin1Char('\n'))) - items.append(s); + QFETCH(QStringList, items); QHash hash; - + + QList realitems; + foreach (const QString &s, items) + realitems.append(s); + QBENCHMARK { - for (int i = 0, n = items.size(); i != n; ++i) { - hash[items.at(i)] = i; + for (int i = 0, n = realitems.size(); i != n; ++i) { + hash[realitems.at(i)] = i; } } } void tst_QHash::javaString() { - QList items; - foreach (const QString &s, data().split(QLatin1Char('\n'))) - items.append(s); + QFETCH(QStringList, items); QHash hash; + QList realitems; + foreach (const QString &s, items) + realitems.append(s); + QBENCHMARK { - for (int i = 0, n = items.size(); i != n; ++i) { - hash[items.at(i)] = i; + for (int i = 0, n = realitems.size(); i != n; ++i) { + hash[realitems.at(i)] = i; } } } diff --git a/tests/benchmarks/corelib/tools/qhash/paths_small_data.txt b/tests/benchmarks/corelib/tools/qhash/paths_small_data.txt new file mode 100644 index 0000000000..d5acd28820 --- /dev/null +++ b/tests/benchmarks/corelib/tools/qhash/paths_small_data.txt @@ -0,0 +1,195 @@ +. +./corelib.pro +./kernel +./kernel/kernel.pro +./kernel/qobject +./kernel/qobject/main.cpp +./kernel/qobject/object.cpp +./kernel/qobject/object.h +./kernel/qobject/Makefile +./kernel/qobject/qobject.pro +./kernel/qvariant +./kernel/qvariant/tst_qvariant.cpp +./kernel/qvariant/Makefile +./kernel/qvariant/qvariant.pro +./kernel/qtimer_vs_qmetaobject +./kernel/qtimer_vs_qmetaobject/tst_qtimer_vs_qmetaobject.cpp +./kernel/qtimer_vs_qmetaobject/Makefile +./kernel/qtimer_vs_qmetaobject/qtimer_vs_qmetaobject.pro +./kernel/.pch +./kernel/.pch/debug-shared +./kernel/qmetaobject +./kernel/qmetaobject/main.cpp +./kernel/qmetaobject/qmetaobject.pro +./kernel/qmetaobject/Makefile +./kernel/Makefile +./kernel/.obj +./kernel/.obj/debug-shared +./kernel/events +./kernel/events/events.pro +./kernel/events/main.cpp +./kernel/events/Makefile +./kernel/qmetatype +./kernel/qmetatype/qmetatype.pro +./kernel/qmetatype/Makefile +./kernel/qmetatype/tst_qmetatype.cpp +./codecs +./codecs/qtextcodec +./codecs/qtextcodec/qtextcodec.pro +./codecs/qtextcodec/main.cpp +./codecs/qtextcodec/Makefile +./codecs/qtextcodec/utf-8.txt +./codecs/codecs.pro +./codecs/.pch +./codecs/.pch/debug-shared +./codecs/Makefile +./codecs/.obj +./codecs/.obj/debug-shared +./.pch +./.pch/debug-shared +./tools +./tools/tools.pro +./tools/qregexp +./tools/qregexp/qregexp.qrc +./tools/qregexp/main.cpp +./tools/qregexp/Makefile +./tools/qregexp/qregexp.pro +./tools/qvector +./tools/qvector/tst_vector +./tools/qvector/.pch +./tools/qvector/.pch/debug-shared +./tools/qvector/qrawvector.h +./tools/qvector/main.cpp +./tools/qvector/Makefile +./tools/qvector/.moc +./tools/qvector/.moc/release-shared +./tools/qvector/.moc/release-shared/main.moc +./tools/qvector/.obj +./tools/qvector/.obj/release-shared +./tools/qvector/.obj/release-shared/outofline.o +./tools/qvector/.obj/release-shared/main.o +./tools/qvector/outofline.cpp +./tools/qvector/qvector.pro +./tools/.pch +./tools/.pch/debug-shared +./tools/qstringbuilder +./tools/qstringbuilder/main.cpp +./tools/qstringbuilder/Makefile +./tools/qstringbuilder/qstringbuilder.pro +./tools/containers-sequential +./tools/containers-sequential/containers-sequential.pro +./tools/containers-sequential/main.cpp +./tools/containers-sequential/Makefile +./tools/qstring +./tools/qstring/generatelist.pl +./tools/qstring/data.h +./tools/qstring/qstring.pro +./tools/qstring/main.cpp +./tools/qstring/data.cpp +./tools/qstring/Makefile +./tools/qstring/utf-8.txt +./tools/qstringlist +./tools/qstringlist/qstringlist.pro +./tools/qstringlist/main.cpp +./tools/qstringlist/.gitignore +./tools/qstringlist/Makefile +./tools/qbytearray +./tools/qbytearray/qbytearray.pro +./tools/qbytearray/main.cpp +./tools/qbytearray/Makefile +./tools/containers-associative +./tools/containers-associative/containers-associative.pro +./tools/containers-associative/main.cpp +./tools/containers-associative/Makefile +./tools/qrect +./tools/qrect/main.cpp +./tools/qrect/Makefile +./tools/qrect/qrect.pro +./tools/Makefile +./tools/qhash +./tools/qhash/data.txt +./tools/qhash/qhash_string.cpp +./tools/qhash/.qhash_string.cpp.swp +./tools/qhash/qhash.pro +./tools/qhash/outofline.cpp +./tools/.obj +./tools/.obj/debug-shared +./Makefile +./.obj +./.obj/debug-shared +./plugin +./plugin/plugin.pro +./plugin/.pch +./plugin/.pch/debug-shared +./plugin/Makefile +./plugin/.obj +./plugin/.obj/debug-shared +./plugin/quuid +./plugin/quuid/tst_quuid.cpp +./plugin/quuid/quuid.pro +./plugin/quuid/Makefile +./io +./io/qtemporaryfile +./io/qtemporaryfile/qtemporaryfile.pro +./io/qtemporaryfile/main.cpp +./io/qtemporaryfile/Makefile +./io/qiodevice +./io/qiodevice/qiodevice.pro +./io/qiodevice/main.cpp +./io/qiodevice/Makefile +./io/qurl +./io/qurl/main.cpp +./io/qurl/Makefile +./io/qurl/qurl.pro +./io/qdir +./io/qdir/.pch +./io/qdir/.pch/debug-shared +./io/qdir/qdir.pro +./io/qdir/tree +./io/qdir/tree/bench_qdir_tree.qrc +./io/qdir/tree/tree.pro +./io/qdir/tree/4.6.0-list.txt +./io/qdir/tree/Makefile +./io/qdir/tree/bench_qdir_tree.cpp +./io/qdir/Makefile +./io/qdir/.obj +./io/qdir/.obj/debug-shared +./io/qdir/10000 +./io/qdir/10000/10000.pro +./io/qdir/10000/bench_qdir_10000.cpp +./io/qdir/10000/Makefile +./io/.pch +./io/.pch/debug-shared +./io/qfile +./io/qfile/qfile.pro +./io/qfile/main.cpp +./io/qfile/Makefile +./io/io.pro +./io/qfileinfo +./io/qfileinfo/qfileinfo.pro +./io/qfileinfo/main.cpp +./io/qfileinfo/Makefile +./io/qdiriterator +./io/qdiriterator/qfilesystemiterator.h +./io/qdiriterator/main.cpp +./io/qdiriterator/Makefile +./io/qdiriterator/qfilesystemiterator.cpp +./io/qdiriterator/qdiriterator.pro +./io/Makefile +./io/.obj +./io/.obj/debug-shared +./thread +./thread/qmutex +./thread/qmutex/tst_qmutex.cpp +./thread/qmutex/Makefile +./thread/qmutex/qmutex.pro +./thread/qthreadstorage +./thread/qthreadstorage/qthreadstorage.pro +./thread/qthreadstorage/Makefile +./thread/qthreadstorage/tst_qthreadstorage.cpp +./thread/.pch +./thread/.pch/debug-shared +./thread/Makefile +./thread/.obj +./thread/.obj/debug-shared +./thread/thread.pro -- cgit v1.2.3 From 4b8ceb41aed352f10d36db5284453f425dbc5f3f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 30 Dec 2011 12:00:09 +0100 Subject: Store the is-a QObject fact with the metatype declaration. This is a source incompatible change for Q_DECLARE_METATYPE(T*), which now requires T to be fully defined. The consequences of this are: * Forward declared types can no longer be declared as a metatype. (though this is a very uncommon thing to do). There is a trivial workaround where necessary. Change-Id: Id74c40088b8c0b466fcd7c55abd616f69acc82c8 Reviewed-by: Lars Knoll --- tests/benchmarks/corelib/tools/qstring/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index be2abe5c51..5ab53e3394 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -1298,6 +1298,11 @@ static int ucstrncmp_ssse3_aligning2(const ushort *a, const ushort *b, int len) #endif typedef int (* UcstrncmpFunction)(const ushort *, const ushort *, int); +QT_BEGIN_NAMESPACE namespace QtPrivate { +template <> struct IsPointerToTypeDerivedFromQObject { + enum { Value = false }; +}; +} QT_END_NAMESPACE Q_DECLARE_METATYPE(UcstrncmpFunction) void tst_QString::ucstrncmp_data() const @@ -1457,6 +1462,11 @@ void tst_QString::fromLatin1() const } typedef void (* FromLatin1Function)(ushort *, const char *, int); +QT_BEGIN_NAMESPACE namespace QtPrivate { +template <> struct IsPointerToTypeDerivedFromQObject { + enum { Value = false }; +}; +} QT_END_NAMESPACE Q_DECLARE_METATYPE(FromLatin1Function) void fromLatin1_regular(ushort *dst, const char *str, int size) @@ -1907,6 +1917,11 @@ void tst_QString::fromLatin1Alternatives() const } typedef int (* FromUtf8Function)(ushort *, const char *, int); +QT_BEGIN_NAMESPACE namespace QtPrivate { +template <> struct IsPointerToTypeDerivedFromQObject { + enum { Value = false }; +}; +} QT_END_NAMESPACE Q_DECLARE_METATYPE(FromUtf8Function) extern QTextCodec::ConverterState *state; -- cgit v1.2.3 From 4ecf82795de54fba530ac9c386f3afff2174edbd Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 9 Jan 2012 08:53:17 +0100 Subject: Remove use of QT_MODULE from library These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll --- tests/benchmarks/corelib/tools/qvector/qrawvector.h | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h index 79d2c26700..25f12c4664 100644 --- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h +++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h @@ -60,7 +60,6 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Core) -- cgit v1.2.3 From 071561f0eba5c92fc6363d54e8f7d4508a42df45 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 25 Jan 2012 21:43:28 +0000 Subject: QHash benchmark: remove unused variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib5abc171fb8fb70e2f73ac92ca22dc09146d8a55 Reviewed-by: João Abecasis Reviewed-by: Robin Burchell --- tests/benchmarks/corelib/tools/qhash/main.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp index f9aec58485..074ddef0e9 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.cpp +++ b/tests/benchmarks/corelib/tools/qhash/main.cpp @@ -65,9 +65,6 @@ private: void data(); }; -const int N = 1000000; -extern double s; - ///////////////////// QHash ///////////////////// void tst_QHash::data() -- cgit v1.2.3 From e1149349c158364854bcfece3c6d80ebccb26f28 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 25 Jan 2012 22:12:43 +0000 Subject: QHash benchmark: improve Java's hash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a bit of documentation to the Java-like hashing function. Change-Id: I3f44eee305d91b76f0f89cd1acf21f6430b9482b Reviewed-by: João Abecasis Reviewed-by: Robin Burchell --- tests/benchmarks/corelib/tools/qhash/outofline.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp index 88fd9c144d..21740536dd 100644 --- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp @@ -87,6 +87,17 @@ uint qHash(const String &str) return h; } +// The Java's hashing algorithm for strings is a variation of D. J. Bernstein +// hashing algorithm appeared here http://cr.yp.to/cdb/cdb.txt +// and informally known as DJB33XX - DJB's 33 Times Xor. +// Java uses DJB31XA, that is, 31 Times Add. +// The original algorithm was a loop around "(h << 5) + h ^ c", +// which is indeed "h * 33 ^ c"; it was then changed to +// "(h << 5) - h ^ c", so "h * 31 ^ c", and the XOR changed to a sum: +// "(h << 5) - h + c", which can save some assembly instructions. +// Still, we can avoid writing the multiplication as "(h << 5) - h" +// -- the compiler will turn it into a shift and an addition anyway +// (for instance, gcc 4.4 does that even at -O0). uint qHash(const JavaString &str) { const unsigned short *p = (unsigned short *)str.constData(); -- cgit v1.2.3 From 5635823e17db3395d9b0fa8cfcc72f82fea583f4 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 24 Jan 2012 16:17:24 +1000 Subject: Remove "All rights reserved" line from license headers. As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern --- tests/benchmarks/corelib/tools/containers-associative/main.cpp | 2 +- tests/benchmarks/corelib/tools/containers-sequential/main.cpp | 2 +- tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp | 1 + tests/benchmarks/corelib/tools/qbytearray/main.cpp | 2 +- tests/benchmarks/corelib/tools/qchar/main.cpp | 2 +- tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp | 2 +- tests/benchmarks/corelib/tools/qhash/main.cpp | 2 +- tests/benchmarks/corelib/tools/qhash/main.h | 2 +- tests/benchmarks/corelib/tools/qhash/outofline.cpp | 2 +- tests/benchmarks/corelib/tools/qlist/main.cpp | 2 +- tests/benchmarks/corelib/tools/qrect/main.cpp | 2 +- tests/benchmarks/corelib/tools/qregexp/main.cpp | 2 +- tests/benchmarks/corelib/tools/qstring/data.h | 2 +- tests/benchmarks/corelib/tools/qstring/generatelist.pl | 2 +- tests/benchmarks/corelib/tools/qstring/generatelist_char.pl | 2 +- tests/benchmarks/corelib/tools/qstring/main.cpp | 2 +- tests/benchmarks/corelib/tools/qstringbuilder/main.cpp | 2 +- tests/benchmarks/corelib/tools/qstringlist/main.cpp | 2 +- tests/benchmarks/corelib/tools/qvector/main.cpp | 2 +- tests/benchmarks/corelib/tools/qvector/outofline.cpp | 2 +- tests/benchmarks/corelib/tools/qvector/qrawvector.h | 2 +- 21 files changed, 21 insertions(+), 20 deletions(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/main.cpp index c38e1fe492..7f2e7b68ca 100644 --- a/tests/benchmarks/corelib/tools/containers-associative/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-associative/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp index 57fc455e4a..ee13a63a57 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp index 751c3e3ae4..d36f8e101c 100644 --- a/tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/benchmarks/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -35,6 +35,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qbytearray/main.cpp b/tests/benchmarks/corelib/tools/qbytearray/main.cpp index 64131f0b2d..72e07ad445 100644 --- a/tests/benchmarks/corelib/tools/qbytearray/main.cpp +++ b/tests/benchmarks/corelib/tools/qbytearray/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qchar/main.cpp b/tests/benchmarks/corelib/tools/qchar/main.cpp index 431fd29f55..80456453c9 100644 --- a/tests/benchmarks/corelib/tools/qchar/main.cpp +++ b/tests/benchmarks/corelib/tools/qchar/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp b/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp index 13cc487112..db0c9f39b2 100644 --- a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp +++ b/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp index 074ddef0e9..6f3228d0eb 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.cpp +++ b/tests/benchmarks/corelib/tools/qhash/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qhash/main.h b/tests/benchmarks/corelib/tools/qhash/main.h index cd2dea576f..c4cf94e190 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.h +++ b/tests/benchmarks/corelib/tools/qhash/main.h @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the QtTest module of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp index 21740536dd..162c604a35 100644 --- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the QtTest module of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qlist/main.cpp b/tests/benchmarks/corelib/tools/qlist/main.cpp index d92da1ca3a..b5fcfea3e6 100644 --- a/tests/benchmarks/corelib/tools/qlist/main.cpp +++ b/tests/benchmarks/corelib/tools/qlist/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qrect/main.cpp b/tests/benchmarks/corelib/tools/qrect/main.cpp index e24f6b9e18..ba81c7bb92 100644 --- a/tests/benchmarks/corelib/tools/qrect/main.cpp +++ b/tests/benchmarks/corelib/tools/qrect/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qregexp/main.cpp b/tests/benchmarks/corelib/tools/qregexp/main.cpp index f9f517994c..d26731edba 100644 --- a/tests/benchmarks/corelib/tools/qregexp/main.cpp +++ b/tests/benchmarks/corelib/tools/qregexp/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qstring/data.h b/tests/benchmarks/corelib/tools/qstring/data.h index a62f128c93..bf39284cb4 100644 --- a/tests/benchmarks/corelib/tools/qstring/data.h +++ b/tests/benchmarks/corelib/tools/qstring/data.h @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist.pl b/tests/benchmarks/corelib/tools/qstring/generatelist.pl index a933f5a326..0cb67fc737 100644 --- a/tests/benchmarks/corelib/tools/qstring/generatelist.pl +++ b/tests/benchmarks/corelib/tools/qstring/generatelist.pl @@ -1,6 +1,5 @@ #!/usr/bin/perl ## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -## All rights reserved. ## Contact: http://www.qt-project.org/ ## ## This file is part of the QtCore module of the Qt Toolkit. @@ -34,6 +33,7 @@ ## ## ## +## ## $QT_END_LICENSE$ # # Parses a file (passed as argument) that contains a dump of pairs of diff --git a/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl b/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl index 6de5eb08ec..9d980f9ed4 100644 --- a/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl +++ b/tests/benchmarks/corelib/tools/qstring/generatelist_char.pl @@ -1,7 +1,6 @@ #!/usr/bin/perl # -*- mode: utf-8; tabs: nil -*- ## Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -## All rights reserved. ## Contact: http://www.qt-project.org/ ## ## This file is part of the QtCore module of the Qt Toolkit. @@ -35,6 +34,7 @@ ## ## ## +## ## $QT_END_LICENSE$ # # Parses a file (passed as argument) that contains a dump of pairs of diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index 5ab53e3394..ca72a9b013 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp index c224dd8ce4..cd82ca746f 100644 --- a/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp +++ b/tests/benchmarks/corelib/tools/qstringbuilder/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite module of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qstringlist/main.cpp b/tests/benchmarks/corelib/tools/qstringlist/main.cpp index 00099e976a..48bf7f1fc5 100644 --- a/tests/benchmarks/corelib/tools/qstringlist/main.cpp +++ b/tests/benchmarks/corelib/tools/qstringlist/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qvector/main.cpp b/tests/benchmarks/corelib/tools/qvector/main.cpp index 3911def018..ee50935832 100644 --- a/tests/benchmarks/corelib/tools/qvector/main.cpp +++ b/tests/benchmarks/corelib/tools/qvector/main.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qvector/outofline.cpp b/tests/benchmarks/corelib/tools/qvector/outofline.cpp index 6e3ea68baf..bf929780a5 100644 --- a/tests/benchmarks/corelib/tools/qvector/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qvector/outofline.cpp @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the QtTest module of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ diff --git a/tests/benchmarks/corelib/tools/qvector/qrawvector.h b/tests/benchmarks/corelib/tools/qvector/qrawvector.h index 25f12c4664..7e570d93ff 100644 --- a/tests/benchmarks/corelib/tools/qvector/qrawvector.h +++ b/tests/benchmarks/corelib/tools/qvector/qrawvector.h @@ -1,7 +1,6 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** Contact: http://www.qt-project.org/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ -- cgit v1.2.3 From 2bf186a2e598a4bccdc4979085e8e4d963a3819d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 25 Jan 2012 17:40:24 +0100 Subject: Allow function types to be registered without workarounds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 4b8ceb41aed352f10d36db5284453f425dbc5f3f added the requirement that pointed-to types need to be registered when registering pointer types. Unfortunately, the implementation also affects function pointer types. This change whitelists 0, 1, 2 and 3 argument functions as not deriving from QObject, forgoing the need to workaround details of the type registration implementation when registering those function pointer types. Change-Id: I4d855e9d70a8179a6e31b84623ad5bf063e0d6d8 Reviewed-by: Jędrzej Nowacki Reviewed-by: Olivier Goffart Reviewed-by: Stephen Kelly --- tests/benchmarks/corelib/tools/qstring/main.cpp | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qstring/main.cpp b/tests/benchmarks/corelib/tools/qstring/main.cpp index ca72a9b013..9d5c43c290 100644 --- a/tests/benchmarks/corelib/tools/qstring/main.cpp +++ b/tests/benchmarks/corelib/tools/qstring/main.cpp @@ -1298,11 +1298,6 @@ static int ucstrncmp_ssse3_aligning2(const ushort *a, const ushort *b, int len) #endif typedef int (* UcstrncmpFunction)(const ushort *, const ushort *, int); -QT_BEGIN_NAMESPACE namespace QtPrivate { -template <> struct IsPointerToTypeDerivedFromQObject { - enum { Value = false }; -}; -} QT_END_NAMESPACE Q_DECLARE_METATYPE(UcstrncmpFunction) void tst_QString::ucstrncmp_data() const @@ -1462,11 +1457,6 @@ void tst_QString::fromLatin1() const } typedef void (* FromLatin1Function)(ushort *, const char *, int); -QT_BEGIN_NAMESPACE namespace QtPrivate { -template <> struct IsPointerToTypeDerivedFromQObject { - enum { Value = false }; -}; -} QT_END_NAMESPACE Q_DECLARE_METATYPE(FromLatin1Function) void fromLatin1_regular(ushort *dst, const char *str, int size) @@ -1917,11 +1907,6 @@ void tst_QString::fromLatin1Alternatives() const } typedef int (* FromUtf8Function)(ushort *, const char *, int); -QT_BEGIN_NAMESPACE namespace QtPrivate { -template <> struct IsPointerToTypeDerivedFromQObject { - enum { Value = false }; -}; -} QT_END_NAMESPACE Q_DECLARE_METATYPE(FromUtf8Function) extern QTextCodec::ConverterState *state; -- cgit v1.2.3 From d1950d8e5294ba016e3050442d578a18c46c97c4 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 1 Feb 2012 16:27:17 +0100 Subject: tests: do not run benchmarks by default in 'make check' `make check' is intended primarily for running functional tests. For the most part, it does not make sense to run benchmarks in the same test environment as the functional tests. Change-Id: I79f867fdab295bdbd4c4b3c785dfd7ede520022e Reviewed-by: Rohan McGovern --- tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/benchmarks/corelib/tools') diff --git a/tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro b/tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro index 0e6e830185..00b63f9863 100644 --- a/tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro +++ b/tests/benchmarks/corelib/tools/qalgorithms/qalgorithms.pro @@ -1,4 +1,3 @@ -CONFIG += testcase TARGET = tst_qalgorithms QT = core testlib SOURCES = tst_qalgorithms.cpp -- cgit v1.2.3