bench: add reproducible foundation benchmark harness and record P0 baseline (X-BASE-05)
This commit is contained in:
1 parent
c64fa93373
commit
196ed251f9
7 files changed
+571
-30
No files matched your search
@@ -8,6 +8,7 @@ elseif(NOT DEFINED BUILD_SHARED_LIBS)
|
|||||||
set(BUILD_SHARED_LIBS ON)
|
set(BUILD_SHARED_LIBS ON)
|
||||||
endif()
|
endif()
|
||||||
option(VOID_ENABLE_TESTING "Build the test suite" ON)
|
option(VOID_ENABLE_TESTING "Build the test suite" ON)
|
||||||
|
option(VOID_ENABLE_BENCHMARKS "Build reproducible benchmark baselines" OFF)
|
||||||
option(VOID_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
|
option(VOID_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
|
||||||
option(VOID_ENABLE_ASAN "Enable AddressSanitizer (Clang/GCC)" OFF)
|
option(VOID_ENABLE_ASAN "Enable AddressSanitizer (Clang/GCC)" OFF)
|
||||||
option(VOID_ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (Clang/GCC)" OFF)
|
option(VOID_ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer (Clang/GCC)" OFF)
|
||||||
@@ -90,6 +91,9 @@ if(VOID_ENABLE_TESTING)
|
|||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
if(VOID_ENABLE_BENCHMARKS)
|
||||||
|
add_subdirectory(benchmarks)
|
||||||
|
endif()
|
||||||
get_property(ALL_DISCOVERED_MODULES GLOBAL PROPERTY VOID_MODULES)
|
get_property(ALL_DISCOVERED_MODULES GLOBAL PROPERTY VOID_MODULES)
|
||||||
get_property(ALL_MODULE_DEPENDENCY_RECORDS GLOBAL PROPERTY
|
get_property(ALL_MODULE_DEPENDENCY_RECORDS GLOBAL PROPERTY
|
||||||
VOID_MODULE_DEPENDENCY_RECORDS)
|
VOID_MODULE_DEPENDENCY_RECORDS)
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
foreach(_req IN ITEMS Core Functional Containers Math Time Binary Data)
|
||||||
|
if(NOT TARGET Void::${_req})
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"[Void] VOID_ENABLE_BENCHMARKS=ON requires foundation module '${_req}' to be enabled")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(_void_git_rev "unknown")
|
||||||
|
find_package(Git QUIET)
|
||||||
|
if(GIT_FOUND)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" rev-parse --short=12 HEAD
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
OUTPUT_VARIABLE _git_out
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_QUIET
|
||||||
|
)
|
||||||
|
if(_git_out)
|
||||||
|
set(_void_git_rev "${_git_out}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(VoidFoundationBench FoundationBench.cpp)
|
||||||
|
set_target_properties(VoidFoundationBench PROPERTIES
|
||||||
|
CXX_STANDARD 26
|
||||||
|
CXX_STANDARD_REQUIRED ON
|
||||||
|
CXX_EXTENSIONS OFF
|
||||||
|
VOID_TESTING_NO_AUTO_SCAN TRUE
|
||||||
|
)
|
||||||
|
target_link_libraries(VoidFoundationBench PRIVATE
|
||||||
|
Void::Core
|
||||||
|
Void::Functional
|
||||||
|
Void::Containers
|
||||||
|
Void::Math
|
||||||
|
Void::Time
|
||||||
|
Void::Binary
|
||||||
|
Void::Data
|
||||||
|
)
|
||||||
|
target_compile_definitions(VoidFoundationBench PRIVATE
|
||||||
|
VOID_GIT_REVISION="${_void_git_rev}"
|
||||||
|
VOID_BUILD_TYPE="$<IF:$<BOOL:${CMAKE_BUILD_TYPE}>,${CMAKE_BUILD_TYPE},unspecified>"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(VOID_WARNINGS_AS_ERRORS)
|
||||||
|
target_compile_options(VoidFoundationBench PRIVATE
|
||||||
|
"$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall;-Wextra;-Wpedantic;-Werror;-Wno-missing-field-initializers>"
|
||||||
|
"$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Wno-missing-designated-field-initializers>"
|
||||||
|
"$<$<CXX_COMPILER_ID:MSVC>:/W4;/WX>"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
@@ -0,0 +1,441 @@
|
|||||||
|
#include <Void/Binary/Reader.hpp>
|
||||||
|
#include <Void/Containers/LRU.hpp>
|
||||||
|
#include <Void/Containers/Ring.hpp>
|
||||||
|
#include <Void/Core/Hash.hpp>
|
||||||
|
#include <Void/Core/Uuid.hpp>
|
||||||
|
#include <Void/Data/Json.hpp>
|
||||||
|
#include <Void/Functional/Error.hpp>
|
||||||
|
#include <Void/Functional/Result.hpp>
|
||||||
|
#include <Void/Math/Numeric.hpp>
|
||||||
|
#include <Void/Time/Bench.hpp>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <array>
|
||||||
|
#include <bit>
|
||||||
|
#include <charconv>
|
||||||
|
#include <chrono>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
|
#include <numeric>
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
struct CliOptions {
|
||||||
|
std::size_t warmup = 5;
|
||||||
|
std::size_t reps = 20;
|
||||||
|
std::size_t ops = 10'000;
|
||||||
|
std::string json_path;
|
||||||
|
std::string filter;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool parse_size(std::string_view text, std::size_t& out) noexcept
|
||||||
|
{
|
||||||
|
if (text.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const char* begin = text.data();
|
||||||
|
const char* end = text.data() + text.size();
|
||||||
|
auto [ptr, ec] = std::from_chars(begin, end, out, 10);
|
||||||
|
return ec == std::errc{} && ptr == end && out > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool parse_args(int argc, char** argv, CliOptions& opts)
|
||||||
|
{
|
||||||
|
for (int i = 1; i < argc; ++i) {
|
||||||
|
const std::string_view arg{argv[i]};
|
||||||
|
auto need_val = [&](std::string_view flag) -> const char* {
|
||||||
|
if (i + 1 >= argc) {
|
||||||
|
std::cerr << "VoidFoundationBench: missing value for " << flag
|
||||||
|
<< '\n';
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return argv[++i];
|
||||||
|
};
|
||||||
|
if (arg == "--warmup") {
|
||||||
|
const char* v = need_val(arg);
|
||||||
|
if (!v || !parse_size(v, opts.warmup)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (arg == "--reps") {
|
||||||
|
const char* v = need_val(arg);
|
||||||
|
if (!v || !parse_size(v, opts.reps)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (arg == "--ops") {
|
||||||
|
const char* v = need_val(arg);
|
||||||
|
if (!v || !parse_size(v, opts.ops)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (arg == "--json") {
|
||||||
|
const char* v = need_val(arg);
|
||||||
|
if (!v) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
opts.json_path = v;
|
||||||
|
} else if (arg == "--filter") {
|
||||||
|
const char* v = need_val(arg);
|
||||||
|
if (!v) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
opts.filter = v;
|
||||||
|
} else {
|
||||||
|
std::cerr << "VoidFoundationBench: unknown argument: " << arg
|
||||||
|
<< '\n';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Stats {
|
||||||
|
double median_ns_per_op{0.0};
|
||||||
|
double min_ns_per_op{0.0};
|
||||||
|
double max_ns_per_op{0.0};
|
||||||
|
double p95_ns_per_op{0.0};
|
||||||
|
double p99_ns_per_op{0.0};
|
||||||
|
double ci95_half_width_ns{0.0};
|
||||||
|
double ops_per_sec{0.0};
|
||||||
|
};
|
||||||
|
|
||||||
|
double nearest_rank(const std::vector<double>& sorted, double quantile)
|
||||||
|
{
|
||||||
|
if (sorted.empty()) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
const std::size_t n = sorted.size();
|
||||||
|
const double raw = std::ceil(quantile * static_cast<double>(n));
|
||||||
|
const std::size_t rank =
|
||||||
|
std::clamp(static_cast<std::size_t>(raw), std::size_t{1}, n);
|
||||||
|
return sorted[rank - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
Stats summarize(const std::vector<double>& samples_ns_per_op)
|
||||||
|
{
|
||||||
|
Stats s{};
|
||||||
|
if (samples_ns_per_op.empty()) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
std::vector<double> sorted = samples_ns_per_op;
|
||||||
|
std::sort(sorted.begin(), sorted.end());
|
||||||
|
|
||||||
|
const std::size_t n = sorted.size();
|
||||||
|
s.min_ns_per_op = sorted.front();
|
||||||
|
s.max_ns_per_op = sorted.back();
|
||||||
|
if (n % 2 == 1) {
|
||||||
|
s.median_ns_per_op = sorted[n / 2];
|
||||||
|
} else {
|
||||||
|
s.median_ns_per_op = 0.5 * (sorted[n / 2 - 1] + sorted[n / 2]);
|
||||||
|
}
|
||||||
|
s.p95_ns_per_op = nearest_rank(sorted, 0.95);
|
||||||
|
s.p99_ns_per_op = nearest_rank(sorted, 0.99);
|
||||||
|
|
||||||
|
const double mean =
|
||||||
|
std::accumulate(sorted.begin(), sorted.end(), 0.0) /
|
||||||
|
static_cast<double>(n);
|
||||||
|
if (n > 1) {
|
||||||
|
double sq = 0.0;
|
||||||
|
for (double v : sorted) {
|
||||||
|
const double d = v - mean;
|
||||||
|
sq += d * d;
|
||||||
|
}
|
||||||
|
const double stdev = std::sqrt(sq / static_cast<double>(n - 1));
|
||||||
|
s.ci95_half_width_ns =
|
||||||
|
1.96 * stdev / std::sqrt(static_cast<double>(n));
|
||||||
|
}
|
||||||
|
s.ops_per_sec =
|
||||||
|
s.median_ns_per_op > 0.0 ? 1'000'000'000.0 / s.median_ns_per_op : 0.0;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct WorkloadRecord {
|
||||||
|
std::string name;
|
||||||
|
std::vector<double> raw_ns_per_op;
|
||||||
|
Stats stats;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Fn>
|
||||||
|
WorkloadRecord run_workload(std::string name, const CliOptions& opts, Fn&& fn)
|
||||||
|
{
|
||||||
|
using Clock = std::chrono::steady_clock;
|
||||||
|
|
||||||
|
for (std::size_t w = 0; w < opts.warmup; ++w) {
|
||||||
|
for (std::size_t i = 0; i < opts.ops; ++i) {
|
||||||
|
fn(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkloadRecord rec;
|
||||||
|
rec.name = std::move(name);
|
||||||
|
rec.raw_ns_per_op.reserve(opts.reps);
|
||||||
|
|
||||||
|
for (std::size_t r = 0; r < opts.reps; ++r) {
|
||||||
|
const auto t0 = Clock::now();
|
||||||
|
for (std::size_t i = 0; i < opts.ops; ++i) {
|
||||||
|
fn(i);
|
||||||
|
}
|
||||||
|
const auto dt = std::chrono::duration<double, std::nano>(Clock::now() - t0).count();
|
||||||
|
rec.raw_ns_per_op.push_back(dt / static_cast<double>(opts.ops));
|
||||||
|
}
|
||||||
|
rec.stats = summarize(rec.raw_ns_per_op);
|
||||||
|
return rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string json_escape(std::string_view in)
|
||||||
|
{
|
||||||
|
std::string out;
|
||||||
|
out.reserve(in.size() + 8);
|
||||||
|
for (char ch : in) {
|
||||||
|
switch (ch) {
|
||||||
|
case '"': out += "\\\""; break;
|
||||||
|
case '\\': out += "\\\\"; break;
|
||||||
|
case '\n': out += "\\n"; break;
|
||||||
|
case '\r': out += "\\r"; break;
|
||||||
|
case '\t': out += "\\t"; break;
|
||||||
|
default: out += ch; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string compiler_label()
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
#if defined(__clang__)
|
||||||
|
oss << "Clang " << __clang_major__ << "." << __clang_minor__ << "."
|
||||||
|
<< __clang_patchlevel__;
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
oss << "GCC " << __GNUC__ << "." << __GNUC_MINOR__ << "."
|
||||||
|
<< __GNUC_PATCHLEVEL__;
|
||||||
|
#else
|
||||||
|
oss << "unknown";
|
||||||
|
#endif
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_json(const std::string& path, const CliOptions& opts,
|
||||||
|
const WorkloadRecord& harness,
|
||||||
|
const std::vector<WorkloadRecord>& records)
|
||||||
|
{
|
||||||
|
std::ofstream out{path};
|
||||||
|
if (!out) {
|
||||||
|
std::cerr << "VoidFoundationBench: failed to open JSON output: "
|
||||||
|
<< path << '\n';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto emit_record = [&](const WorkloadRecord& rec, const char* indent) {
|
||||||
|
out << indent << "{\n";
|
||||||
|
out << indent << " \"name\": \"" << json_escape(rec.name) << "\",\n";
|
||||||
|
out << indent << " \"median_ns_per_op\": " << std::fixed
|
||||||
|
<< std::setprecision(4) << rec.stats.median_ns_per_op << ",\n";
|
||||||
|
out << indent << " \"min_ns_per_op\": " << rec.stats.min_ns_per_op
|
||||||
|
<< ",\n";
|
||||||
|
out << indent << " \"max_ns_per_op\": " << rec.stats.max_ns_per_op
|
||||||
|
<< ",\n";
|
||||||
|
out << indent << " \"p95_ns_per_op\": " << rec.stats.p95_ns_per_op
|
||||||
|
<< ",\n";
|
||||||
|
out << indent << " \"p99_ns_per_op\": " << rec.stats.p99_ns_per_op
|
||||||
|
<< ",\n";
|
||||||
|
out << indent << " \"ci95_half_width_ns\": "
|
||||||
|
<< rec.stats.ci95_half_width_ns << ",\n";
|
||||||
|
out << indent << " \"ops_per_sec\": " << std::setprecision(2)
|
||||||
|
<< rec.stats.ops_per_sec << ",\n";
|
||||||
|
out << indent << " \"raw_samples_ns_per_op\": [";
|
||||||
|
out << std::setprecision(4);
|
||||||
|
for (std::size_t i = 0; i < rec.raw_ns_per_op.size(); ++i) {
|
||||||
|
if (i > 0) {
|
||||||
|
out << ", ";
|
||||||
|
}
|
||||||
|
out << rec.raw_ns_per_op[i];
|
||||||
|
}
|
||||||
|
out << "]\n";
|
||||||
|
out << indent << "}";
|
||||||
|
};
|
||||||
|
|
||||||
|
out << "{\n";
|
||||||
|
out << " \"schema_version\": 1,\n";
|
||||||
|
out << " \"git_revision\": \"" << json_escape(VOID_GIT_REVISION) << "\",\n";
|
||||||
|
out << " \"compiler\": \"" << json_escape(compiler_label()) << "\",\n";
|
||||||
|
out << " \"build_type\": \"" << json_escape(VOID_BUILD_TYPE) << "\",\n";
|
||||||
|
out << " \"hardware_concurrency\": "
|
||||||
|
<< std::thread::hardware_concurrency() << ",\n";
|
||||||
|
out << " \"warmup\": " << opts.warmup << ",\n";
|
||||||
|
out << " \"repetitions\": " << opts.reps << ",\n";
|
||||||
|
out << " \"ops_per_rep\": " << opts.ops << ",\n";
|
||||||
|
out << " \"harness_baseline\": ";
|
||||||
|
emit_record(harness, " ");
|
||||||
|
out << ",\n";
|
||||||
|
out << " \"workloads\": [\n";
|
||||||
|
for (std::size_t i = 0; i < records.size(); ++i) {
|
||||||
|
emit_record(records[i], " ");
|
||||||
|
if (i + 1 < records.size()) {
|
||||||
|
out << ",";
|
||||||
|
}
|
||||||
|
out << "\n";
|
||||||
|
}
|
||||||
|
out << " ]\n";
|
||||||
|
out << "}\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
CliOptions opts;
|
||||||
|
if (!parse_args(argc, argv, opts)) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Separate empty-loop harness baseline (not subtracted from results).
|
||||||
|
const auto harness = run_workload("harness_empty_loop", opts, [](std::size_t i) {
|
||||||
|
Void::Bench::do_not_optimize(i);
|
||||||
|
});
|
||||||
|
|
||||||
|
std::array<std::byte, 256> payload{};
|
||||||
|
for (std::size_t i = 0; i < payload.size(); ++i) {
|
||||||
|
payload[i] = static_cast<std::byte>((i * 131u + 17u) & 0xFFu);
|
||||||
|
}
|
||||||
|
const std::string_view payload_sv{
|
||||||
|
reinterpret_cast<const char*>(payload.data()), payload.size()};
|
||||||
|
const std::string_view uuid_text = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
||||||
|
const auto parsed_uuid = Void::Uuid::parse(uuid_text).value();
|
||||||
|
const std::string_view small_json_text =
|
||||||
|
R"({"id":42,"name":"void-bench","active":true,"tags":["p0","foundation"]})";
|
||||||
|
const auto small_json_val = Void::Json::parse(small_json_text).value();
|
||||||
|
const std::array<std::byte, 8> be_u64{
|
||||||
|
std::byte{0x01}, std::byte{0x23}, std::byte{0x45}, std::byte{0x67},
|
||||||
|
std::byte{0x89}, std::byte{0xAB}, std::byte{0xCD}, std::byte{0xEF}};
|
||||||
|
|
||||||
|
Void::Ring::SpscRing<std::uint64_t, 64> ring;
|
||||||
|
Void::LRU::LruCache<std::uint64_t, std::uint64_t> lru{128};
|
||||||
|
for (std::uint64_t k = 0; k < 128; ++k) {
|
||||||
|
lru.put(k, k * 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<WorkloadRecord> records;
|
||||||
|
auto maybe_run = [&](std::string_view name, auto&& fn) {
|
||||||
|
if (!opts.filter.empty() && name.find(opts.filter) == std::string_view::npos) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
records.push_back(run_workload(std::string{name}, opts, fn));
|
||||||
|
};
|
||||||
|
|
||||||
|
maybe_run("core_uuid_parse_hyphenated", [&](std::size_t) {
|
||||||
|
auto u = Void::Uuid::parse(uuid_text);
|
||||||
|
Void::Bench::do_not_optimize(u);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("core_uuid_to_string", [&](std::size_t) {
|
||||||
|
auto s = parsed_uuid.to_string();
|
||||||
|
Void::Bench::do_not_optimize(s);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("core_hash_fnv1a64_256b", [&](std::size_t) {
|
||||||
|
auto h = Void::Hash::fnv1a64(std::span<const std::byte>{payload});
|
||||||
|
Void::Bench::do_not_optimize(h);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("core_hash_murmur3_256b", [&](std::size_t i) {
|
||||||
|
auto h = Void::Hash::murmur3_32(payload_sv, static_cast<std::uint32_t>(i));
|
||||||
|
Void::Bench::do_not_optimize(h);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("functional_result_ok_chain", [&](std::size_t i) {
|
||||||
|
auto r = Void::Result::ok(static_cast<int>(i))
|
||||||
|
.transform([](int v) { return v + 1; })
|
||||||
|
.and_then([](int v) -> Void::Result::Result<int> {
|
||||||
|
return Void::Result::ok(v * 2);
|
||||||
|
});
|
||||||
|
Void::Bench::do_not_optimize(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("functional_error_with_context", [&](std::size_t) {
|
||||||
|
Void::Result::Result<int> base = Void::Result::fail("io error");
|
||||||
|
auto wrapped = Void::Result::with_context(std::move(base), "read header");
|
||||||
|
Void::Bench::do_not_optimize(wrapped);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("math_checked_add_loop", [&](std::size_t i) {
|
||||||
|
auto r = Void::Numeric::checked_add(static_cast<std::uint64_t>(i),
|
||||||
|
std::uint64_t{42});
|
||||||
|
Void::Bench::do_not_optimize(r);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("containers_spsc_ring_push_pop", [&](std::size_t i) {
|
||||||
|
const bool pushed = ring.push(static_cast<std::uint64_t>(i));
|
||||||
|
auto popped = ring.pop();
|
||||||
|
Void::Bench::do_not_optimize(pushed);
|
||||||
|
Void::Bench::do_not_optimize(popped);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("containers_lru_get_put", [&](std::size_t i) {
|
||||||
|
const std::uint64_t key = static_cast<std::uint64_t>(i) & 255u;
|
||||||
|
auto hit = lru.get(key);
|
||||||
|
if (!hit) {
|
||||||
|
lru.put(key, key * 3);
|
||||||
|
}
|
||||||
|
Void::Bench::do_not_optimize(hit);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("binary_reader_u64_be", [&](std::size_t) {
|
||||||
|
Void::Binary::Reader reader{be_u64};
|
||||||
|
auto v = reader.read<std::uint64_t>(std::endian::big);
|
||||||
|
Void::Bench::do_not_optimize(v);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("data_json_parse_small_object", [&](std::size_t) {
|
||||||
|
auto v = Void::Json::parse(small_json_text);
|
||||||
|
Void::Bench::do_not_optimize(v);
|
||||||
|
});
|
||||||
|
|
||||||
|
maybe_run("data_json_serialize_small_object", [&](std::size_t) {
|
||||||
|
auto s = Void::Json::serialize(small_json_val);
|
||||||
|
Void::Bench::do_not_optimize(s);
|
||||||
|
});
|
||||||
|
|
||||||
|
std::cout << "VoidFoundationBench (rev=" << VOID_GIT_REVISION
|
||||||
|
<< ", build=" << VOID_BUILD_TYPE
|
||||||
|
<< ", compiler=" << compiler_label()
|
||||||
|
<< ", warmup=" << opts.warmup
|
||||||
|
<< ", reps=" << opts.reps
|
||||||
|
<< ", ops=" << opts.ops << ")\n\n";
|
||||||
|
std::cout << std::left << std::setw(34) << "Workload"
|
||||||
|
<< std::right << std::setw(11) << "Med(ns)"
|
||||||
|
<< std::setw(11) << "p95(ns)"
|
||||||
|
<< std::setw(11) << "p99(ns)"
|
||||||
|
<< std::setw(11) << "CI95(+-)"
|
||||||
|
<< std::setw(14) << "Ops/s\n";
|
||||||
|
std::cout << std::string(92, '-') << '\n';
|
||||||
|
|
||||||
|
auto print_row = [](const WorkloadRecord& r) {
|
||||||
|
std::cout << std::left << std::setw(34) << r.name
|
||||||
|
<< std::right << std::fixed << std::setprecision(2)
|
||||||
|
<< std::setw(11) << r.stats.median_ns_per_op
|
||||||
|
<< std::setw(11) << r.stats.p95_ns_per_op
|
||||||
|
<< std::setw(11) << r.stats.p99_ns_per_op
|
||||||
|
<< std::setw(11) << r.stats.ci95_half_width_ns
|
||||||
|
<< std::setprecision(0)
|
||||||
|
<< std::setw(13) << r.stats.ops_per_sec << '\n';
|
||||||
|
};
|
||||||
|
|
||||||
|
print_row(harness);
|
||||||
|
for (const auto& rec : records) {
|
||||||
|
print_row(rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!opts.json_path.empty()) {
|
||||||
|
write_json(opts.json_path, opts, harness, records);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -1,44 +1,49 @@
|
|||||||
# Workflow state
|
# Workflow state
|
||||||
|
|
||||||
Updated: 2026-11-24.
|
Updated: 2026-11-24.
|
||||||
Repository: VoidLibrary; branch `main`; baseline HEAD
|
Repository: VoidLibrary; active branch `feat/roadmap-p0-p1-foundations` (from `main`
|
||||||
`f1f9ba375b22abf1adcc7c550ec21ac20895c0a4`.
|
at `f1f9ba375b22abf1adcc7c550ec21ac20895c0a4`).
|
||||||
|
|
||||||
## Completed objective
|
## Completed objective
|
||||||
|
|
||||||
The approved multi-file expansion planning package is authored and verified: 54 roadmap
|
1. Approved multi-file expansion planning package committed (`faa8a51`): 54 roadmap
|
||||||
documents with 300 planned feature tasks. Application implementation, release, and
|
documents with 300 planned feature tasks and workflow records.
|
||||||
deployment are not part of this documentation delivery.
|
2. **Wave 1 / P0 Reliable Baseline (`X-BASE-01`..`X-BASE-05`) implemented & verified**:
|
||||||
|
- `X-BASE-01`: Replaced hardcoded `/bin/echo`, `/bin/cat`, and `seq` in process tests
|
||||||
|
with standard-library `VoidProcessHelper`.
|
||||||
|
- `X-BASE-02`: Marked FetchContent Boost 1.84 as `SYSTEM` so `-DVOID_WARNINGS_AS_ERRORS=ON`
|
||||||
|
succeeds cleanly on GCC 16.2.0 (`-std=c++26`).
|
||||||
|
- `X-BASE-03`: Transferred `<Void/Log/Log.hpp>` header ownership to `LogState`,
|
||||||
|
reconciled acyclic `INTERNAL_DEPS` across 10 `module.cmake` files, added
|
||||||
|
`Void::FunctionalCoreFormatting`, propagated `-freflection` on `INTERFACE` modules,
|
||||||
|
filtered `VoidTests` by `ACTIVE_MODULES`, and verified minimal, `System`-only,
|
||||||
|
embedded `add_subdirectory`, static, and relocated installed consumers.
|
||||||
|
- `X-BASE-04`: Added `cmake/Capabilities.cmake` (`VOID_HAS_STD_EXPECTED`,
|
||||||
|
`VOID_HAS_CXX26_REFLECTION`, sanitizer probes, `ASan`+`TSan` mutual exclusion) and
|
||||||
|
`VOID_ENABLE_TSAN`; verified Debug ASan+UBSan+`-Werror` full suite and TSan subset.
|
||||||
|
- `X-BASE-05`: Added `VOID_ENABLE_BENCHMARKS` (`benchmarks/FoundationBench.cpp`) and
|
||||||
|
`tests/corpus/README.md`; recorded P0 foundation benchmark manifest.
|
||||||
|
|
||||||
## Baseline and authorization
|
## Baseline and authorization
|
||||||
|
|
||||||
The tracked tree was clean before authoring. Existing unrelated untracked files were
|
User decisions D-027..D-030 authorize roadmap-order execution on branch
|
||||||
left untouched. The user approved the proposal with “Implement the plan.” Confirmed
|
`feat/roadmap-p0-p1-foundations`, per-task workflow specs in `docs/agent-workflow/tasks/`,
|
||||||
requirements and decisions are recorded in the roadmap and DECISIONS.md.
|
and Wave A+B API compatibility while leaving local untracked files untouched.
|
||||||
|
|
||||||
Prior read-only exploration, architectural planning, primary-source research, and
|
## Verification already observed (P0)
|
||||||
independent preflight are complete. Preflight verdict: READY, with one minor wording
|
|
||||||
correction applied. Current stage: DOCUMENTATION_COMPLETE. Independent reviews A and B
|
|
||||||
are READY after all four P2 findings were corrected and rechecked. No feature
|
|
||||||
implementation has started.
|
|
||||||
|
|
||||||
## Verification already observed
|
- Full RelWithDebInfo + `-DVOID_WARNINGS_AS_ERRORS=ON` via
|
||||||
|
`dev cpp-gcc -p libarchive -p openssl -p sqlite -p libsodium`: build passed (exit 0);
|
||||||
- GCC 16.2.0, CMake 4.4.4; separate all-module RelWithDebInfo configure/build succeeded.
|
`ctest` 2/2 passed (`VoidTests` 1,249 passed / 3 intentional skips / 0 failed;
|
||||||
- VoidTests: 1,250 discovered; 1,245 passed, 2 failed, 3 skipped.
|
`VoidInstalledComponentConsumers` including relocated `Foundation` and `External` passed).
|
||||||
- The failures hard-code absent `/bin/echo` and `/bin/cat` on this NixOS host.
|
- Minimal foundation subset, `System` without `Log` (`Log.hpp` installed), embedded
|
||||||
- Installed component-consumer test passed.
|
`add_subdirectory`, and static (`BUILD_SHARED_LIBS=OFF`) builds/tests all passed.
|
||||||
- Warnings-as-errors configuration failed in pinned Boost 1.84 headers.
|
- Full Debug ASan+UBSan+`-Werror`: `VoidTests` 1,249 passed, 3 skipped, 0 failed, 0 leaks/UB.
|
||||||
- No sanitizer, cross-platform, performance, or new-feature verification is claimed.
|
- Debug TSan subset (`Async;Time;Core;Functional;Testing`): 389 passed, 2 skipped, 0 failed.
|
||||||
|
- `VoidFoundationBench` (RelWithDebInfo, 5 warmup, 20 reps, 10,000 ops/rep): 12 workloads +
|
||||||
|
empty-harness baseline recorded to `/tmp/void-p0-bench/baseline.json`.
|
||||||
|
|
||||||
## Ownership and next step
|
## Ownership and next step
|
||||||
|
|
||||||
Root owns shared contracts, master index, delivery/validation plans, workflow records,
|
Proceeding to Wave 2 (P1 Gate 1): `Core` (`M-CORE-02`, `M-CORE-03`), `Functional`
|
||||||
integration, and review. Separate documentation workers receive exclusive area files.
|
(`M-FUNCTIONAL-02`), `Time` (`M-TIME-02`), `Memory` (`S-MEMORY-02..04`), and `Math` (`M-MATH-02`).
|
||||||
See TASKS.md for durable assignments; live agent processes are not persistent state.
|
|
||||||
|
|
||||||
Coverage/link/task checks and direct Markdown checks pass; final evidence is in
|
|
||||||
VERIFICATION.md. Documentation workers/reviewers are closed. All future feature tasks
|
|
||||||
remain PLANNED. Subsequent implementation starts with a bounded task selected from
|
|
||||||
DELIVERY.md and its area plan after reconciling the current source state. Nothing has
|
|
||||||
been staged, committed, pushed or deployed by this delivery.
|
|
||||||
@@ -13,6 +13,16 @@ These tasks author plans. Future feature task IDs inside those plans remain plan
|
|||||||
| T-DOC-REVIEW-A | Fresh independent shared/foundation review | astra_reviewer | READY | All 21 documents reviewed; P2 dependency correction and current/proposed Update wording rechecked; no remaining actionable findings |
|
| T-DOC-REVIEW-A | Fresh independent shared/foundation review | astra_reviewer | READY | All 21 documents reviewed; P2 dependency correction and current/proposed Update wording rechecked; no remaining actionable findings |
|
||||||
| T-DOC-REVIEW-B | Fresh independent runtime/storage/network/platform review | astra_reviewer | READY | All 33 area plans reviewed; three P2 corrections and affected acceptance rows rechecked; no remaining actionable findings |
|
| T-DOC-REVIEW-B | Fresh independent runtime/storage/network/platform review | astra_reviewer | READY | All 33 area plans reviewed; three P2 corrections and affected acceptance rows rechecked; no remaining actionable findings |
|
||||||
|
|
||||||
|
## Wave 1 — P0 Baseline Implementation (`feat/roadmap-p0-p1-foundations`)
|
||||||
|
|
||||||
|
| ID | Deliverable | Spec | State | Verification summary |
|
||||||
|
| --- | --- | --- | --- | --- |
|
||||||
|
| X-BASE-01 | Controlled `VoidProcessHelper` replacing `/bin/echo`, `/bin/cat`, `seq` | [X-BASE-01](tasks/X-BASE-01.md) | VERIFIED | `Process`/`ProcessStream` 13/13; full `VoidTests` 1,249 passed, 3 skipped |
|
||||||
|
| X-BASE-02 | Boost 1.84 FetchContent `SYSTEM` isolation for `-Werror` | [X-BASE-02](tasks/X-BASE-02.md) | VERIFIED | Full `-DVOID_WARNINGS_AS_ERRORS=ON` build exit 0; `VoidTests` 1,249 passed |
|
||||||
|
| X-BASE-03 | `Log.hpp` in `LogState`, acyclic closures, `FunctionalCoreFormatting`, `-freflection` propagation, subset/relocated/static/embedded checks | [X-BASE-03](tasks/X-BASE-03.md) | VERIFIED | Full `ctest` 2/2 passed (`VoidTests` + relocated consumers), plus minimal, `System`-only, embedded, static passed |
|
||||||
|
| X-BASE-04 | `cmake/Capabilities.cmake`, reflection/`expected`/sanitizer probes, `VOID_ENABLE_TSAN` | [X-BASE-04](tasks/X-BASE-04.md) | VERIFIED | ASan+UBSan+`-Werror` full `VoidTests` 1,249 passed (0 leaks/UB); TSan subset 389 passed |
|
||||||
|
| X-BASE-05 | `benchmarks/FoundationBench.cpp` (`VOID_ENABLE_BENCHMARKS`) + `tests/corpus/README.md` | [X-BASE-05](tasks/X-BASE-05.md) | VERIFIED | RelWithDebInfo `-Werror` build passed; 12 workloads + harness JSON baseline validated |
|
||||||
|
|
||||||
All workers share the checkout and have disjoint file ownership defined in their
|
All workers share the checkout and have disjoint file ownership defined in their
|
||||||
persisted task specifications. Root owns all cross-cutting files and resolves contract
|
persisted task specifications. Root owns all cross-cutting files and resolves contract
|
||||||
changes. No worker owns application code, build files, existing docs/short-url.md, or Git
|
changes. No worker owns application code, build files, existing docs/short-url.md, or Git
|
||||||
|
|||||||
@@ -143,3 +143,17 @@ No C++ source or build-system modification is part of this delivery. Application
|
|||||||
are not rerun solely for Markdown authoring. Sanitizers, fuzzing, benchmarks, alternative
|
are not rerun solely for Markdown authoring. Sanitizers, fuzzing, benchmarks, alternative
|
||||||
platforms, NEW APIs, native storage and distributed scenarios remain unrun/planned.
|
platforms, NEW APIs, native storage and distributed scenarios remain unrun/planned.
|
||||||
Written designs and proposed commands do not establish implementation or release readiness.
|
Written designs and proposed commands do not establish implementation or release readiness.
|
||||||
|
|
||||||
|
## Wave 1 / P0 Implementation Verification (2026-11-24)
|
||||||
|
|
||||||
|
Branch: `feat/roadmap-p0-p1-foundations`. Toolchain via `dev cpp-gcc`: GCC 16.2.0, CMake 4.4.4, Ninja 1.13.2.
|
||||||
|
|
||||||
|
| Task | Command & scope | Observed outcome |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| X-BASE-01 | `/tmp/void-p0-base/tests/VoidTests --filter "Process*"` and full `/tmp/void-p0-base/tests/VoidTests` | `Process`+`ProcessStream` 13/13 passed; full `VoidTests` 1,249 passed, 3 intentional skips, 0 failed (`340acae`) |
|
||||||
|
| X-BASE-02 | Full RelWithDebInfo `-DVOID_WARNINGS_AS_ERRORS=ON` build & `VoidTests` in `/tmp/void-p0-werror` | Exit 0 (all 691 Ninja targets clean); `VoidTests` 1,249 passed, 3 skipped, 0 failed (`e385746`) |
|
||||||
|
| X-BASE-03 | `dev cpp-gcc -p libarchive -p openssl -p sqlite -p libsodium -c ctest --test-dir /tmp/void-p0-closures --output-on-failure --timeout 120` | 2/2 passed: `VoidTests` + `VoidInstalledComponentConsumers` (`Binary`, `Foundation`, `Audited`, `External`, `RelocatedFoundation`, `RelocatedExternal`) (`cd6fc7e`) |
|
||||||
|
| X-BASE-03 | Minimal (`Time;Math;Text;Binary;Functional;FunctionalCoreFormatting;Testing`), `System;Testing`, `tests/package/Embedded`, static (`BUILD_SHARED_LIBS=OFF`) | All 4 passed; `System` without `Log` installs `include/Void/Log/Log.hpp` and passes `Process*` |
|
||||||
|
| X-BASE-04 | `dev cpp-gcc -p libarchive -p openssl -p sqlite -p libsodium -c bash -lc 'ASAN_OPTIONS=detect_leaks=1:halt_on_error=1 UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 /tmp/void-p0-asan/tests/VoidTests'` | 1,249 passed, 3 skipped, 0 failed, 0 ASan/UBSan/LSan errors (`c64fa93`) |
|
||||||
|
| X-BASE-04 | `dev cpp-gcc -c /tmp/void-p0-tsan/tests/VoidTests` (`Async;Time;Core;Functional;Testing`, Debug, `-DVOID_ENABLE_TSAN=ON -DVOID_WARNINGS_AS_ERRORS=ON`) | Capabilities: `reflection=yes, expected=yes, sanitizers=TSan`; 389 passed, 2 skipped, 0 failed, 0 TSan races |
|
||||||
|
| X-BASE-05 | `dev cpp-gcc -c /tmp/void-p0-bench/benchmarks/VoidFoundationBench --json /tmp/void-p0-bench/baseline.json` (RelWithDebInfo, `-DVOID_WARNINGS_AS_ERRORS=ON`, 5 warmup, 20 reps, 10k ops/rep) | Exit 0; JSON schema_version 1 validated. Key baselines: `harness_empty_loop` 0.38ns, `core_uuid_parse_hyphenated` 88.76ns, `core_uuid_to_string` 498.11ns, `data_json_parse_small_object` 295.46ns |
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Seeded Parser and Codec Regression Corpus
|
||||||
|
|
||||||
|
Status: initial directory layout created under `X-BASE-05`. Regression fixtures
|
||||||
|
for parsers and codecs (`Binary`, `Data`, `Text`) are populated in P1 and P2 tasks.
|
||||||
|
|
||||||
|
## Planned Subdirectories
|
||||||
|
|
||||||
|
- `Binary/`: valid and adversarial varints, boundary integers, truncated frames.
|
||||||
|
- `Data/`: strict vs general JSON numbers, duplicate policies, VVB1 golden bytes,
|
||||||
|
malformed CSV/INI inputs.
|
||||||
|
- `Text/`: UTF-8/percent/Base64/Hex/Semver boundary inputs.
|
||||||
|
|
||||||
|
## Fixture Metadata Rules
|
||||||
|
|
||||||
|
Each corpus entry carries deterministic inputs only (no credentials, personal data,
|
||||||
|
or external network dependencies). Minimized parser/fuzz failures added as regressions
|
||||||
|
retain reproducible seed/input files alongside standalone unit tests.
|
||||||
Reference in new issue
Block a user