summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-08-17 20:44:39 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-06-21 11:46:59 +0000
commite4750177536d096221a50d221124a4f1047a5456 (patch)
tree4261af41a72025954c709567c11511bb8c42e21c /src/testlib/qtestcase.cpp
parent3045ac99f296b866b25df318f13726d8f64494e8 (diff)
QtTest: don't hold QBenchmarkResults in QList
QBenchmarkResult is larger than a void*, so holding them in a QList is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Also saves ~1.2KiB of text size on GCC 4.9 optimized C++11 AMD64 Linux builds. Change-Id: I0c99e591bb9b4405aa1bb78ec095dcaf9277993f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 7dc846db4d..be68f8d866 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1925,7 +1925,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
QTestLog::addLogger(logFormat, logFilename);
}
-QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container)
+QBenchmarkResult qMedian(const QVector<QBenchmarkResult> &container)
{
const int count = container.count();
if (count == 0)
@@ -1934,7 +1934,7 @@ QBenchmarkResult qMedian(const QList<QBenchmarkResult> &container)
if (count == 1)
return container.front();
- QList<QBenchmarkResult> containerCopy = container;
+ QVector<QBenchmarkResult> containerCopy = container;
std::sort(containerCopy.begin(), containerCopy.end());
const int middle = count / 2;
@@ -1971,7 +1971,7 @@ static void qInvokeTestMethodDataEntry(char *slot)
bool isBenchmark = false;
int i = (QBenchmarkGlobalData::current->measurer->needsWarmupIteration()) ? -1 : 0;
- QList<QBenchmarkResult> results;
+ QVector<QBenchmarkResult> results;
bool minimumTotalReached = false;
do {
QBenchmarkTestMethodData::current->beginDataRun();