Share one arena across batch

This commit is contained in:
2024-02-09 17:57:29 -08:00
parent 855d72d9a7
commit f961947e33

View File

@@ -777,7 +777,8 @@ Vector<uint8_t> getSearchPath(Arena &arena, Node *n) {
}
bool checkRangeRead(Node *n, const std::span<const uint8_t> begin,
const std::span<const uint8_t> end, int64_t readVersion) {
const std::span<const uint8_t> end, int64_t readVersion,
Arena &arena) {
auto left = FirstGeqStepwise{n, begin};
auto right = FirstGeqStepwise{n, end};
bool leftDone = left.step();
@@ -829,7 +830,6 @@ bool checkRangeRead(Node *n, const std::span<const uint8_t> begin,
return false;
}
Arena arena{10 << 10};
auto searchPath = getSearchPath(arena, left.n);
for (auto *iter = nextPhysical(left.n, searchPath); iter != right.n;) {
@@ -945,6 +945,7 @@ void destroyTree(Node *root) {
struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
void check(const ReadRange *reads, Result *result, int count) const {
Arena arena{64 << 10};
for (int i = 0; i < count; ++i) {
result[i] =
reads[i].readVersion < oldestVersion ? TooOld
@@ -954,7 +955,7 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
reads[i].begin.len),
std::span<const uint8_t>(reads[i].end.p,
reads[i].end.len),
reads[i].readVersion)
reads[i].readVersion, arena)
: checkPointRead(root,
std::span<const uint8_t>(reads[i].begin.p,
reads[i].begin.len),