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:
parent
86e92972dd
commit
45c137d797
@ -584,7 +584,7 @@ struct Data
|
|||||||
numBuckets = GrowthPolicy::bucketsForCapacity(qMax(size, reserved));
|
numBuckets = GrowthPolicy::bucketsForCapacity(qMax(size, reserved));
|
||||||
spans = allocateSpans(numBuckets).spans;
|
spans = allocateSpans(numBuckets).spans;
|
||||||
size_t otherNSpans = other.numBuckets >> SpanConstants::SpanShift;
|
size_t otherNSpans = other.numBuckets >> SpanConstants::SpanShift;
|
||||||
reallocationHelper(other, otherNSpans, true);
|
reallocationHelper(other, otherNSpans, numBuckets != other.numBuckets);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Data *detached(Data *d)
|
static Data *detached(Data *d)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user