summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2009-12-10 10:15:26 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2009-12-10 10:17:35 (GMT)
commit8d790367928765c861bd437583d12849517839ba (patch)
tree7ac0909e533fd7492c21be776111d3f747195a59 /tests/benchmarks
parent6db765ddb88ab8d64560902b75724fc1fca42551 (diff)
downloadQt-8d790367928765c861bd437583d12849517839ba.zip
Qt-8d790367928765c861bd437583d12849517839ba.tar.gz
Qt-8d790367928765c861bd437583d12849517839ba.tar.bz2
Fixed containers-sequential benchmark for Symbian
- RVCT 2.2. couldn't compile static templated function f(), so changed it to non-static, as it should make no difference for this test. - Limited insert_Large tests to fit to typical Symbian device memory. - Some whitespace fixed, too. Task-number: QTBUG-6592 Reviewed-by: Janne Anttila
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/containers-sequential/main.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/benchmarks/containers-sequential/main.cpp b/tests/benchmarks/containers-sequential/main.cpp
index 76643ca..885db3e 100644
--- a/tests/benchmarks/containers-sequential/main.cpp
+++ b/tests/benchmarks/containers-sequential/main.cpp
@@ -59,7 +59,7 @@ public:
};
template <typename T>
-static T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
+T * f(T *ts) // dummy function to prevent code from being optimized away by the compiler
{
return ts;
}
@@ -81,7 +81,7 @@ class UseCases_QVector : public UseCases<T>
void lookup(int size)
{
QVector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.append(t);
@@ -113,7 +113,7 @@ class UseCases_stdvector : public UseCases<T>
void lookup(int size)
{
std::vector<T> v;
-
+
T t;
for (int i = 0; i < size; ++i)
v.push_back(t);
@@ -132,6 +132,13 @@ struct Large { // A "large" item type
int x[1000];
};
+// Symbian devices typically have limited memory
+#ifdef Q_OS_SYMBIAN
+# define LARGE_MAX_SIZE 2000
+#else
+# define LARGE_MAX_SIZE 20000
+#endif
+
class tst_vector_vs_std : public QObject
{
Q_OBJECT
@@ -190,7 +197,7 @@ void tst_vector_vs_std::insert_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
@@ -236,7 +243,7 @@ void tst_vector_vs_std::lookup_Large_data()
QTest::addColumn<bool>("useStd");
QTest::addColumn<int>("size");
- for (int size = 10; size < 20000; size += 100) {
+ for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;