diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2020-08-11 19:30:15 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2020-08-20 18:24:15 +0300 |
commit | a41c61fb2d2f973fd1cd5e95ee5be1ac1a4f8433 (patch) | |
tree | 857130e663aa61ebbf09d7da9a1670aa81a9e69b /src/corelib/io/qprocess.cpp | |
parent | 729d102b1c5273087c54d1584c80f1a1e6eef86c (diff) |
QIODevice: implement a "zero-copy" strategy for buffered writes
It works as follows:
- user calls write(const QByteArray &);
- this function keeps a pointer to the chunk and calls a regular
write(data, len);
- write(data, len) calls a virtual writeData();
- subclass calls a new QIODevicePrivate::write();
- QIODevicePrivate::write() makes a shallow copy of
the byte array.
Proposed solution is fully compatible with existing subclasses.
By replacing a call to d->writeBuffer.append() with d->write(),
subclasses can improve their performance.
Bump the TypeInformationVersion field in qtHookData, to notify the
Qt Creator developers that the offset of QFilePrivate::fileName was
changed and dumpers should be adapted.
Change-Id: I24713386cc74a9f37e5223c617e4b1ba97f968dc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index b56ead8584..8e8664fda4 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1899,7 +1899,7 @@ qint64 QProcess::writeData(const char *data, qint64 len) } #endif - d->writeBuffer.append(data, len); + d->write(data, len); #ifdef Q_OS_WIN if (!d->stdinWriteTrigger->isActive()) d->stdinWriteTrigger->start(); |