diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2016-10-25 15:52:55 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-07-07 18:40:31 +0000 |
commit | 49ab284d3445c61a0ea819bbe2dd2ed54241d2e9 (patch) | |
tree | b874dd840d17e1c6bbb7d95c309df84495cca40f /src/corelib/io/qfileinfo_p.h | |
parent | 0b7d9d28119d27bd6ccb277876f4d904d1d7afcb (diff) |
Stop using QVector in QFileInfoPrivate
This was added in 32629676b977d98e853fc6101a63c0d888ff5598 for Qt 5.1
because QDateTime always allocated memory, so QVector was much faster
for default-created objects. Since Qt 5.7, QDateTime no longer allocates
memory in the default constructor, and in Qt 5.8 on 64-bit systems, it
won't allocate memory at all for most reasonable dates, so construction
times are acceptable now.
Change-Id: If0ad4d988da143b3b1b2fffd1480e83121cddc8c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/io/qfileinfo_p.h')
-rw-r--r-- | src/corelib/io/qfileinfo_p.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/corelib/io/qfileinfo_p.h b/src/corelib/io/qfileinfo_p.h index 806df179e8..d45cf6be33 100644 --- a/src/corelib/io/qfileinfo_p.h +++ b/src/corelib/io/qfileinfo_p.h @@ -56,7 +56,6 @@ #include "qatomic.h" #include "qshareddata.h" #include "qfilesystemengine_p.h" -#include "qvector.h" #include <QtCore/private/qabstractfileengine_p.h> #include <QtCore/private/qfilesystementry_p.h> @@ -158,19 +157,14 @@ public: QScopedPointer<QAbstractFileEngine> const fileEngine; mutable QString fileNames[QAbstractFileEngine::NFileNames]; - mutable QString fileOwners[2]; + mutable QString fileOwners[2]; // QAbstractFileEngine::FileOwner: OwnerUser and OwnerGroup + mutable QDateTime fileTimes[4]; // QAbstractFileEngine::FileTime: BirthTime, MetadataChangeTime, ModificationTime, AccessTime mutable uint cachedFlags : 30; bool const isDefaultConstructed : 1; // QFileInfo is a default constructed instance bool cache_enabled : 1; mutable uint fileFlags; mutable qint64 fileSize; - // ### Qt6: FIXME: This vector is essentially a plain array - // mutable QDateTime fileTimes[3], but the array is slower - // to initialize than the QVector as QDateTime has a pimpl. - // In Qt 6, QDateTime should inline its data members, - // and this here can be an array again. - mutable QVector<QDateTime> fileTimes; inline bool getCachedFlag(uint c) const { return cache_enabled ? (cachedFlags & c) : 0; } inline void setCachedFlag(uint c) const |