Added support for UBJSON; resolves #245 (#251)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2024-11-10 11:38:00 +01:00
committed by GitHub
parent 716de7b6fd
commit b71f82b4f1
66 changed files with 2277 additions and 11 deletions
+25
View File
@@ -9,6 +9,7 @@
#include <rfl/json.hpp>
#include <rfl/msgpack.hpp>
#include <rfl/toml.hpp>
#include <rfl/ubjson.hpp>
#include <rfl/yaml.hpp>
#include <type_traits>
#include <vector>
@@ -164,6 +165,30 @@ static void BM_canada_read_reflect_cpp_toml(benchmark::State &state) {
}
BENCHMARK(BM_canada_read_reflect_cpp_toml);
static void BM_canada_read_reflect_cpp_ubjson(benchmark::State &state) {
const auto data = rfl::ubjson::write(load_data());
for (auto _ : state) {
const auto res = rfl::ubjson::read<FeatureCollection>(data);
if (!res) {
std::cout << res.error()->what() << std::endl;
}
}
}
BENCHMARK(BM_canada_read_reflect_cpp_ubjson);
static void BM_canada_read_reflect_cpp_ubjson_without_field_names(
benchmark::State &state) {
const auto data = rfl::ubjson::write<rfl::NoFieldNames>(load_data());
for (auto _ : state) {
const auto res =
rfl::ubjson::read<FeatureCollection, rfl::NoFieldNames>(data);
if (!res) {
std::cout << res.error()->what() << std::endl;
}
}
}
BENCHMARK(BM_canada_read_reflect_cpp_ubjson_without_field_names);
static void BM_canada_read_reflect_cpp_yaml(benchmark::State &state) {
const auto data = rfl::yaml::write(load_data());
for (auto _ : state) {