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);
|
||||
if (partialKeyIndex < self->partialKeyLen) {
|
||||
auto *old = self;
|
||||
|
||||
self = allocators->node4.allocate();
|
||||
self->maxVersion = old->maxVersion;
|
||||
|
||||
memcpy((void *)self, old, offsetof(Node, type));
|
||||
self->partialKeyLen = partialKeyIndex;
|
||||
self->parent = old->parent;
|
||||
self->parentsIndex = old->parentsIndex;
|
||||
memcpy(self->partialKey, old->partialKey, partialKeyIndex);
|
||||
self->entryPresent = false;
|
||||
self->numChildren = 0;
|
||||
|
||||
getOrCreateChild(self, old->partialKey[partialKeyIndex], allocators) =
|
||||
old;
|
||||
|
Reference in New Issue
Block a user