From 31c6d9f04ba80e6776ae01cb0588e6bd228f7184 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 7 Sep 2014 01:18:22 +0200 Subject: 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 Reviewed-by: Marc Mutz --- src/corelib/io/qtextstream_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/io/qtextstream_p.h') 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 -- cgit v1.2.3