// Build with c++ -O3 -DNDEBUG -std=c++17 -Iinclude bench/scale.cpp -o scale // Usage: ./scale [feeds [subscribers-per-feed [regular-ttl-groups]]] #include "pulsefold.hpp" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace { using Clock = std::chrono::steady_clock; using Id = std::uint32_t; using Time = std::uint64_t; using Event = std::tuple; constexpr Time base_ttl = 4096; Id positive(const char* arg) { const std::string value(arg); Id n = 0; const auto end = value.data() + value.size(); const auto parsed = std::from_chars(value.data(), end, n); if (parsed.ec != std::errc{} || parsed.ptr != end || n == 0) throw std::invalid_argument("dimensions must be positive 32-bit integers"); return n; } Time nanoseconds(Clock::time_point a, Clock::time_point b) { return std::chrono::duration_cast(b - a).count(); } // Linux reports the process-wide resident high-water mark in KiB. Other // platforms still run and validate the workload, with a null RSS result. std::optional