From a41c61fb2d2f973fd1cd5e95ee5be1ac1a4f8433 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 11 Aug 2020 19:30:15 +0300 Subject: QIODevice: implement a "zero-copy" strategy for buffered writes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: MÃ¥rten Nordheim --- src/network/socket/qabstractsocket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/network/socket/qabstractsocket.cpp') diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index cf6a7672fb..3bde2215ad 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -2542,7 +2542,7 @@ qint64 QAbstractSocket::writeData(const char *data, qint64 size) // We just write to our write buffer and enable the write notifier // The write notifier then flush()es the buffer. - d->writeBuffer.append(data, size); + d->write(data, size); qint64 written = size; if (d->socketEngine && !d->writeBuffer.isEmpty()) -- cgit v1.2.3