#pragma once #include "json_benchmark/file_runner.h" #include namespace distinct_user_id { using namespace json_benchmark; template struct runner : public file_runner { std::vector result{}; bool setup(benchmark::State &state) { return this->load_json(state, TWITTER_JSON); } bool before_run(benchmark::State &state) { if (!file_runner::before_run(state)) { return false; } result.clear(); return true; } bool run(benchmark::State &) { return this->implementation.run(this->json, result); } bool after_run(benchmark::State &state) { if (!file_runner::after_run(state)) { return false; } std::sort(result.begin(), result.end()); auto last = std::unique(result.begin(), result.end()); result.erase(last, result.end()); return true; } template bool diff(benchmark::State &state, runner &reference) { return diff_results(state, result, reference.result, diff_flags::NONE); } size_t items_per_iteration() { return result.size(); } }; struct simdjson_dom; template simdjson_really_inline static void distinct_user_id(benchmark::State &state) { run_json_benchmark, runner>(state); } } // namespace distinct_user_id