diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2024-01-30 17:04:25 +0100 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2024-01-31 22:44:03 +0100 |
commit | 45c137d797a85c694897e8b1c5099abacc16e2f5 (patch) | |
tree | bcf584558a8582d01e39441c56b0c0de373332ac /src/corelib/tools | |
parent | 86e92972dd1df463f8da859f651ba0eb76dacd50 (diff) |
QHash: improve perf when detaching with potential growth
By not assuming we will have resized.
reserve(size() + 1) will have suffered a bit from this, but
that is probably not very common.
Change-Id: I8750d430f532a72729ed06e67c0f315707a916d6
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qhash.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 72fdb70c54..216d710cc9 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -584,7 +584,7 @@ struct Data numBuckets = GrowthPolicy::bucketsForCapacity(qMax(size, reserved)); spans = allocateSpans(numBuckets).spans; size_t otherNSpans = other.numBuckets >> SpanConstants::SpanShift; - reallocationHelper(other, otherNSpans, true); + reallocationHelper(other, otherNSpans, numBuckets != other.numBuckets); } static Data *detached(Data *d) |