maybeDecreaseCapacity policy was too strong
We can allow larger capacities and still pay for the key bytes
This commit is contained in:
@@ -292,9 +292,10 @@ static_assert(kNode3Surplus >= kMinNodeSurplus);
|
||||
static_assert(kBytesPerKey - sizeof(Node0) >= kMinNodeSurplus);
|
||||
|
||||
// setOldestVersion will additionally try to maintain this property:
|
||||
// `max(children, 1) * length >= capacity`
|
||||
// `(children + entryPresent) * length >= capacity`
|
||||
//
|
||||
// Which should give us the budget to pay for the key bytes
|
||||
// Which should give us the budget to pay for the key bytes. (children +
|
||||
// entryPresent) is a lower bound on how many keys these bytes are a prefix of
|
||||
|
||||
template <class T, int64_t kMemoryBound = (1 << 20)>
|
||||
struct BoundedFreeListAllocator {
|
||||
@@ -910,7 +911,7 @@ void makeCapacityAtLeast(Node *&self, int capacity, NodeAllocators *allocators,
|
||||
void maybeDecreaseCapacity(Node *&self, NodeAllocators *allocators,
|
||||
ConflictSet::Impl *impl) {
|
||||
const int maxCapacity =
|
||||
std::max<int>(self->numChildren, 1) * self->partialKeyLen;
|
||||
(self->numChildren + int(self->entryPresent)) * self->partialKeyLen;
|
||||
if (self->partialKeyCapacity <= maxCapacity) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user