Add benchmark
All checks were successful
Tests / Release [gcc] total: 363, passed: 363
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap: Reference build: <a href="https://jenkins.weaselab.dev/job/weaselab/job/conflict-set/job/main/12//gcc">weaselab » conflict-set » main #12</a>
Tests / Coverage total: 361, passed: 361
weaselab/conflict-set/pipeline/head This commit looks good

This commit is contained in:
2024-02-11 09:16:04 -08:00
parent 0cae645c17
commit d60da4c087
3 changed files with 160 additions and 82 deletions

View File

@@ -4,6 +4,7 @@
#include <algorithm>
#include <bit>
#include <cassert>
#include <compare>
#include <cstdint>
#include <cstring>
#include <inttypes.h>
@@ -21,15 +22,6 @@
// ==================== BEGIN IMPLEMENTATION ====================
int compare(std::span<const uint8_t> lhs, std::span<const uint8_t> rhs) {
int cl = std::min<int>(lhs.size(), rhs.size());
int c = cl == 0 ? 0 : memcmp(lhs.data(), rhs.data(), cl);
if (c != 0) {
return c;
}
return int(lhs.size()) - int(rhs.size());
}
std::span<uint8_t> strincMutate(std::span<uint8_t> str, bool &ok) {
int index;
for (index = str.size() - 1; index >= 0; index--)
@@ -793,7 +785,7 @@ bool checkRangeRead(Node *n, const std::span<const uint8_t> begin,
}
bool first = true;
for (auto *iter = left.n; iter != nullptr && compare(searchPath, end) < 0;
for (auto *iter = left.n; iter != nullptr && searchPath < end;
first = false) {
if (iter->entryPresent) {
if (!first && iter->entry.rangeVersion > readVersion) {
@@ -811,11 +803,11 @@ bool checkRangeRead(Node *n, const std::span<const uint8_t> begin,
#endif
bool ok = true;
auto rangeEnd = strincMutate(searchPath, ok);
int c;
auto c = std::strong_ordering::equal;
if (!ok) {
goto iterate;
}
c = compare(rangeEnd, end);
c = rangeEnd <=> end;
--rangeEnd.back();
if (c == 0) {