summaryrefslogtreecommitdiff
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2009-05-27 11:45:47 +0200
committerhjk <qtc-committer@nokia.com>2009-05-27 11:46:10 +0200
commit28303e861dfa53fb5b7388e2b0269a1abd5c0100 (patch)
tree32f144d852f1215c62b76e7d7ad26fd3ccd389f6 /tests/benchmarks
parentefc0b20859d1cfd5949191f6b2b65f9266c49625 (diff)
downloadqt-creator-28303e861dfa53fb5b7388e2b0269a1abd5c0100.tar.gz
qstringbuilder: a version without QLatin1Literal
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/qstringbuilder/main.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/benchmarks/qstringbuilder/main.cpp b/tests/benchmarks/qstringbuilder/main.cpp
index 6cecfba6b4..4010db0e60 100644
--- a/tests/benchmarks/qstringbuilder/main.cpp
+++ b/tests/benchmarks/qstringbuilder/main.cpp
@@ -13,15 +13,17 @@
#define SEP(s) qDebug() << "\n\n-------- " s " ---------";
#define L(s) QLatin1String(s)
+const char l1literal[] = "some string literal";
+
class tst_qstringbuilder : public QObject
{
Q_OBJECT
public:
tst_qstringbuilder()
- : l1literal("some string literal"),
- l1string("some string literal"),
- ba("some string literal"),
+ :
+ l1string(l1literal),
+ ba(l1literal),
string(l1string),
stringref(&string, 2, 10),
achar('c')
@@ -71,12 +73,12 @@ private slots:
void separator_1() { SEP("literal + literal (builder first)"); }
void b_2_l1literal() {
- QBENCHMARK { r = l1literal % l1literal; }
+ QBENCHMARK { r = l1string % l1literal; }
COMPARE(r, l1string + l1string);
}
void s_2_l1string() {
QBENCHMARK { r = l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal));
+ COMPARE(r, QString(l1string % l1literal));
}
@@ -139,37 +141,37 @@ private slots:
void separator_3() { SEP("3 literals"); }
void b_3_l1literal() {
- QBENCHMARK { r = l1literal % l1literal % l1literal; }
+ QBENCHMARK { r = l1string % l1literal % l1literal; }
COMPARE(r, l1string + l1string + l1string);
}
void s_3_l1string() {
QBENCHMARK { r = l1string + l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal % l1literal));
+ COMPARE(r, QString(l1string % l1literal % l1literal));
}
void separator_4() { SEP("4 literals"); }
void b_4_l1literal() {
- QBENCHMARK { r = l1literal % l1literal % l1literal % l1literal; }
+ QBENCHMARK { r = l1string % l1literal % l1literal % l1literal; }
COMPARE(r, l1string + l1string + l1string + l1string);
}
void s_4_l1string() {
QBENCHMARK { r = l1string + l1string + l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal % l1literal % l1literal));
+ COMPARE(r, QString(l1string % l1literal % l1literal % l1literal));
}
void separator_5() { SEP("5 literals"); }
void b_5_l1literal() {
- QBENCHMARK { r = l1literal % l1literal % l1literal % l1literal %l1literal; }
+ QBENCHMARK { r = l1string % l1literal % l1literal % l1literal %l1literal; }
COMPARE(r, l1string + l1string + l1string + l1string + l1string);
}
void s_5_l1string() {
QBENCHMARK { r = l1string + l1string + l1string + l1string + l1string; }
- COMPARE(r, QString(l1literal % l1literal % l1literal % l1literal % l1literal));
+ COMPARE(r, QString(l1string % l1literal % l1literal % l1literal % l1literal));
}
@@ -260,7 +262,6 @@ private slots:
}
private:
- const QLatin1Literal l1literal;
const QLatin1String l1string;
const QByteArray ba;
const QString string;