QIODevice: use QVLA to hold the ring buffers, not QList

The only users of more than one read- or write channel are the SCTP
code and QProcess. SCTP being pretty rare, optimize for the common
case of at most two QRingBuffers for reading (QProcess) and one for
writing.  Even with more channels, QVLA shouldn't be slower than QList
- on the contrary.

Need to adjust tst_toolsupport and TypeInformationVersion, as
QFilePrivate::fileName has changed.

Pick-to: 6.3
Change-Id: I3baf982ba1f4dc51463be8730e414f6164072d8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2021-12-12 14:23:58 +01:00
parent 7ef6140170
commit 63a35898f4
3 changed files with 6 additions and 6 deletions

View File

@ -67,7 +67,7 @@ quintptr Q_CORE_EXPORT qtHookData[] = {
// The required sizes and offsets are tested in tests/auto/other/toolsupport.
// When this fails and the change was intentional, adjust the test and
// adjust this value here.
21
22,
};
static_assert(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0]));

View File

@ -53,9 +53,9 @@
#include "QtCore/qbytearray.h"
#include "QtCore/qiodevice.h"
#include "QtCore/qlist.h"
#include "QtCore/qobjectdefs.h"
#include "QtCore/qstring.h"
#include "QtCore/qvarlengtharray.h"
#include "private/qringbuffer_p.h"
#ifndef QT_NO_QOBJECT
#include "private/qobject_p.h"
@ -134,8 +134,8 @@ public:
int readBufferChunkSize = QIODEVICE_BUFFERSIZE;
int writeBufferChunkSize = 0;
QList<QRingBuffer> readBuffers;
QList<QRingBuffer> writeBuffers;
QVarLengthArray<QRingBuffer, 2> readBuffers;
QVarLengthArray<QRingBuffer, 1> writeBuffers;
QString errorString;
QIODevice::OpenMode openMode = QIODevice::NotOpen;

View File

@ -142,9 +142,9 @@ void tst_toolsupport::offsets_data()
#ifdef Q_PROCESSOR_X86
// x86 32-bit has weird alignment rules. Refer to QtPrivate::AlignOf in
// qglobal.h for more details.
data << 188 << 304;
data << 264 << 424;
#else
data << 196 << 304;
data << 300 << 424;
#endif
}
#endif