summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-15 13:00:37 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-06-28 15:56:02 +0000
commit435a3d77415d6b9f859839edd907df17ee54f569 (patch)
treeb00e4ac048bbf952ef53eaff12c03ecd49afa736 /src/sql
parent027571c8c3efe8b1451fb73b74be7e617db1899f (diff)
QSqlIndex: replace QList<bool> with QVector<bool>
QList<bool> uses from 400% (32-bit platforms) to 800% (64-bit) more per-element memory than QVector<bool>. This change is binary compatible, since QList and QVector have the same size, and the QList field was not referenced from inline functions. This includes all relevant special member functions, since they are all out-of-line (and move assignment and move constructor are disabled by used-defined copy assignment and copy constructors, resp.). The header is unchanged from Qt 5.0, so there were also no past inline users of the member. Change-Id: I3a94ddc73a4f388031dfd4fce3fedccc507a39c7 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/kernel/qsqlindex.cpp3
-rw-r--r--src/sql/kernel/qsqlindex.h5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/sql/kernel/qsqlindex.cpp b/src/sql/kernel/qsqlindex.cpp
index 53e13c85e6..bb80cf3e03 100644
--- a/src/sql/kernel/qsqlindex.cpp
+++ b/src/sql/kernel/qsqlindex.cpp
@@ -38,6 +38,9 @@
QT_BEGIN_NAMESPACE
+// ### Qt 6: remove the static assertion, the 'sorts' field was changed from QList to QVector in Qt 5.6
+Q_STATIC_ASSERT((sizeof(QList<bool>) == sizeof(QVector<bool>)));
+
/*!
\class QSqlIndex
\brief The QSqlIndex class provides functions to manipulate and
diff --git a/src/sql/kernel/qsqlindex.h b/src/sql/kernel/qsqlindex.h
index d3d4a7c9aa..4a81d48161 100644
--- a/src/sql/kernel/qsqlindex.h
+++ b/src/sql/kernel/qsqlindex.h
@@ -36,7 +36,10 @@
#include <QtSql/qsqlrecord.h>
#include <QtCore/qstring.h>
+#include <QtCore/qvector.h>
+#if QT_DEPRECATED_SINCE(5,6)
#include <QtCore/qlist.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -63,7 +66,7 @@ private:
QString createField(int i, const QString& prefix, bool verbose) const;
QString cursor;
QString nm;
- QList<bool> sorts;
+ QVector<bool> sorts;
};
QT_END_NAMESPACE