diff options
author | hjk <qtc-committer@nokia.com> | 2011-03-16 16:02:56 (GMT) |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2011-03-16 16:02:56 (GMT) |
commit | 65ae717b2c8fc979ccb30c967335999a6d90eb4f (patch) | |
tree | d5fcac2ca0d3da3524460ce398add5549e479dcf /src/corelib | |
parent | 59e1092c5d6a748f8d144b1decadde2dfcb3f7cc (diff) | |
download | Qt-65ae717b2c8fc979ccb30c967335999a6d90eb4f.zip Qt-65ae717b2c8fc979ccb30c967335999a6d90eb4f.tar.gz Qt-65ae717b2c8fc979ccb30c967335999a6d90eb4f.tar.bz2 |
corelib/tools: Add two ### Qt 5 comments
A proposol to speed up qHash(QString) and QVector.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qhash.cpp | 4 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 66ec660..b6ba8b2 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -54,6 +54,10 @@ QT_BEGIN_NAMESPACE + +// ### Qt 5: see tests/benchmarks/corelib/tools/qhash/qhash_string.cpp +// Hashing of the whole string is a waste of cycles. + /* These functions are based on Peter J. Weinberger's hash function (from the Dragon Book). The constant 24 in the original function diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 56d1cca..9418642 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -115,6 +115,8 @@ class QVector }; public: + // ### Qt 5: Consider making QVector non-shared to get at least one + // "really fast" container. See tests/benchmarks/corelib/tools/qvector/ inline QVector() : d(&QVectorData::shared_null) { d->ref.ref(); } explicit QVector(int size); QVector(int size, const T &t); |