2021-01-05 04:21:50 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#if SIMDJSON_EXCEPTIONS
|
|
|
|
|
|
|
|
#include "large_random.h"
|
|
|
|
|
|
|
|
namespace large_random {
|
|
|
|
|
|
|
|
using namespace simdjson;
|
|
|
|
|
2021-01-05 12:20:24 +08:00
|
|
|
struct simdjson_ondemand_unordered {
|
2021-01-07 11:58:38 +08:00
|
|
|
static constexpr diff_flags DiffFlags = diff_flags::NONE;
|
|
|
|
|
2021-01-05 04:21:50 +08:00
|
|
|
ondemand::parser parser{};
|
2021-01-05 12:20:24 +08:00
|
|
|
|
2021-01-06 03:31:34 +08:00
|
|
|
bool run(simdjson::padded_string &json, std::vector<point> &result) {
|
2021-01-05 04:21:50 +08:00
|
|
|
auto doc = parser.iterate(json);
|
|
|
|
for (ondemand::object coord : doc) {
|
2021-01-07 11:58:38 +08:00
|
|
|
result.emplace_back(json_benchmark::point{coord["x"], coord["y"], coord["z"]});
|
2021-01-05 04:21:50 +08:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-01-06 02:45:49 +08:00
|
|
|
BENCHMARK_TEMPLATE(large_random, simdjson_ondemand_unordered)->UseManualTime();
|
2021-01-05 04:21:50 +08:00
|
|
|
|
|
|
|
} // namespace large_random
|
|
|
|
|
|
|
|
#endif // SIMDJSON_EXCEPTIONS
|