Group read only queries together

This commit is contained in:
2024-11-22 17:35:59 -08:00
parent 61f5612e1f
commit e5e6402b43

View File

@@ -1369,6 +1369,48 @@ bool checkRangeVersionOfFirstGeq(Node *node, InternalVersionT readVersion) {
return node->entry.rangeVersion <= readVersion;
}
Node *nextPhysical(Node *node) {
Node *nextChild = getFirstChild(node);
if (nextChild != nullptr) {
return nextChild;
}
for (;;) {
int index = node->parentsIndex;
node = node->parent;
if (node == nullptr) {
return nullptr;
}
Node *nextChild = getChildGeq(node, index + 1);
if (nextChild != nullptr) {
return nextChild;
}
}
}
Node *nextLogical(Node *node) {
Node *nextChild = getFirstChild(node);
if (nextChild != nullptr) {
node = nextChild;
goto downLeftSpine;
}
for (;;) {
int index = node->parentsIndex;
node = node->parent;
if (node == nullptr) {
return nullptr;
}
Node *nextChild = getChildGeq(node, index + 1);
if (nextChild != nullptr) {
node = nextChild;
goto downLeftSpine;
}
}
downLeftSpine:
for (; !node->entryPresent; node = getFirstChild(node)) {
}
return node;
}
// self must not be the root
void maybeDecreaseCapacity(Node *&self, WriteContext *writeContext);
@@ -1613,48 +1655,6 @@ TaggedNodePointer &getOrCreateChild(TaggedNodePointer &self, TrivialSpan &key,
}
}
Node *nextPhysical(Node *node) {
Node *nextChild = getFirstChild(node);
if (nextChild != nullptr) {
return nextChild;
}
for (;;) {
int index = node->parentsIndex;
node = node->parent;
if (node == nullptr) {
return nullptr;
}
Node *nextChild = getChildGeq(node, index + 1);
if (nextChild != nullptr) {
return nextChild;
}
}
}
Node *nextLogical(Node *node) {
Node *nextChild = getFirstChild(node);
if (nextChild != nullptr) {
node = nextChild;
goto downLeftSpine;
}
for (;;) {
int index = node->parentsIndex;
node = node->parent;
if (node == nullptr) {
return nullptr;
}
Node *nextChild = getChildGeq(node, index + 1);
if (nextChild != nullptr) {
node = nextChild;
goto downLeftSpine;
}
}
downLeftSpine:
for (; !node->entryPresent; node = getFirstChild(node)) {
}
return node;
}
void freeAndMakeCapacity(Node *&self, int capacity,
WriteContext *writeContext) {
++writeContext->accum.nodes_resized;