summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qtextstream_p.h
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2014-09-07 01:18:22 +0200
committerDavid Faure <david.faure@kdab.com>2014-09-12 02:07:36 +0200
commit31c6d9f04ba80e6776ae01cb0588e6bd228f7184 (patch)
tree57d9af62890d4d3d922527251226e7c512777d69 /src/corelib/io/qtextstream_p.h
parent66008040793f7e98f9cacd13271119b6b096d8bc (diff)
QTextStream: add fast path for writing char and QChar.
Avoids allocating a QString for every char being written out. The benchmark went from 5.5 ms per iteration to 0.8 ms, and from 40 million instructions to 6 million. Found using Milian Wolff's heaptrack tool. Change-Id: I1784c47b944454bc947a607a22c39d249372ed55 Reviewed-by: Adam Majer <adamm@zombino.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/io/qtextstream_p.h')
-rw-r--r--src/corelib/io/qtextstream_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/io/qtextstream_p.h b/src/corelib/io/qtextstream_p.h
index ac6529e195..ea431a4620 100644
--- a/src/corelib/io/qtextstream_p.h
+++ b/src/corelib/io/qtextstream_p.h
@@ -174,7 +174,9 @@ public:
bool getReal(double *f);
inline void write(const QString &data);
+ inline void write(QChar ch);
inline void putString(const QString &ch, bool number = false);
+ inline void putChar(QChar ch);
void putNumber(qulonglong number, bool negative);
// buffers