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>
This commit is contained in:
Mårten Nordheim 2024-01-30 17:04:25 +01:00
parent 86e92972dd
commit 45c137d797

View File

@ -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)