Move index closer to start of Node{3,16}
This should slightly improve cache hit rate
This commit is contained in:
@@ -338,11 +338,12 @@ struct Node3 : Node {
|
|||||||
constexpr static auto kMaxNodes = 3;
|
constexpr static auto kMaxNodes = 3;
|
||||||
constexpr static auto kType = Type_Node3;
|
constexpr static auto kType = Type_Node3;
|
||||||
|
|
||||||
TaggedNodePointer children[kMaxNodes];
|
|
||||||
InternalVersionT childMaxVersion[kMaxNodes];
|
|
||||||
// Sorted
|
// Sorted
|
||||||
uint8_t index[kMaxNodes];
|
uint8_t index[kMaxNodes];
|
||||||
|
|
||||||
|
TaggedNodePointer children[kMaxNodes];
|
||||||
|
InternalVersionT childMaxVersion[kMaxNodes];
|
||||||
|
|
||||||
uint8_t *partialKey() {
|
uint8_t *partialKey() {
|
||||||
assert(!releaseDeferred);
|
assert(!releaseDeferred);
|
||||||
return (uint8_t *)(this + 1);
|
return (uint8_t *)(this + 1);
|
||||||
@@ -357,11 +358,12 @@ struct Node16 : Node {
|
|||||||
constexpr static auto kType = Type_Node16;
|
constexpr static auto kType = Type_Node16;
|
||||||
constexpr static auto kMaxNodes = 16;
|
constexpr static auto kMaxNodes = 16;
|
||||||
|
|
||||||
TaggedNodePointer children[kMaxNodes];
|
|
||||||
InternalVersionT childMaxVersion[kMaxNodes];
|
|
||||||
// Sorted
|
// Sorted
|
||||||
uint8_t index[kMaxNodes];
|
uint8_t index[kMaxNodes];
|
||||||
|
|
||||||
|
TaggedNodePointer children[kMaxNodes];
|
||||||
|
InternalVersionT childMaxVersion[kMaxNodes];
|
||||||
|
|
||||||
uint8_t *partialKey() {
|
uint8_t *partialKey() {
|
||||||
assert(!releaseDeferred);
|
assert(!releaseDeferred);
|
||||||
return (uint8_t *)(this + 1);
|
return (uint8_t *)(this + 1);
|
||||||
@@ -440,7 +442,10 @@ inline void Node3::copyChildrenAndKeyFrom(const Node0 &other) {
|
|||||||
inline void Node3::copyChildrenAndKeyFrom(const Node3 &other) {
|
inline void Node3::copyChildrenAndKeyFrom(const Node3 &other) {
|
||||||
memcpy((char *)this + kNodeCopyBegin, (char *)&other + kNodeCopyBegin,
|
memcpy((char *)this + kNodeCopyBegin, (char *)&other + kNodeCopyBegin,
|
||||||
kNodeCopySize);
|
kNodeCopySize);
|
||||||
memcpy(children, other.children, sizeof(*this) - sizeof(Node));
|
memcpy(index, other.index, kMaxNodes);
|
||||||
|
memcpy(children, other.children, kMaxNodes * sizeof(children[0])); // NOLINT
|
||||||
|
memcpy(childMaxVersion, other.childMaxVersion,
|
||||||
|
kMaxNodes * sizeof(childMaxVersion[0]));
|
||||||
memcpy(partialKey(), &other + 1, partialKeyLen);
|
memcpy(partialKey(), &other + 1, partialKeyLen);
|
||||||
for (int i = 0; i < numChildren; ++i) {
|
for (int i = 0; i < numChildren; ++i) {
|
||||||
assert(children[i]->parent == &other);
|
assert(children[i]->parent == &other);
|
||||||
|
|||||||
Reference in New Issue
Block a user