Copy old node to new more efficiently
Presumably it's generating good code for the memcpy with a static size, and hopefully also eliminating redundant stores
This commit is contained in:
@@ -1419,12 +1419,13 @@ bool checkRangeRead(Node *n, std::span<const uint8_t> begin,
|
|||||||
longestCommonPrefixPartialKey(self->partialKey, key.data(), commonLen);
|
longestCommonPrefixPartialKey(self->partialKey, key.data(), commonLen);
|
||||||
if (partialKeyIndex < self->partialKeyLen) {
|
if (partialKeyIndex < self->partialKeyLen) {
|
||||||
auto *old = self;
|
auto *old = self;
|
||||||
|
|
||||||
self = allocators->node4.allocate();
|
self = allocators->node4.allocate();
|
||||||
self->maxVersion = old->maxVersion;
|
|
||||||
|
memcpy((void *)self, old, offsetof(Node, type));
|
||||||
self->partialKeyLen = partialKeyIndex;
|
self->partialKeyLen = partialKeyIndex;
|
||||||
self->parent = old->parent;
|
self->entryPresent = false;
|
||||||
self->parentsIndex = old->parentsIndex;
|
self->numChildren = 0;
|
||||||
memcpy(self->partialKey, old->partialKey, partialKeyIndex);
|
|
||||||
|
|
||||||
getOrCreateChild(self, old->partialKey[partialKeyIndex], allocators) =
|
getOrCreateChild(self, old->partialKey[partialKeyIndex], allocators) =
|
||||||
old;
|
old;
|
||||||
|
Reference in New Issue
Block a user