mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-03 16:56:17 +08:00
Added support for Apache Avro, and thus for schemaful formats (#303)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <array>
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
#include <rfl/avro.hpp>
|
||||
#include <rfl/bson.hpp>
|
||||
#include <rfl/cbor.hpp>
|
||||
#include <rfl/flexbuf.hpp>
|
||||
@@ -47,6 +48,18 @@ static FeatureCollection load_data() {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static void BM_canada_read_reflect_cpp_avro(benchmark::State &state) {
|
||||
const auto schema = rfl::avro::to_schema<FeatureCollection>();
|
||||
const auto data = rfl::avro::write(load_data(), schema);
|
||||
for (auto _ : state) {
|
||||
const auto res = rfl::avro::read<FeatureCollection>(data, schema);
|
||||
if (!res) {
|
||||
std::cout << res.error()->what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
BENCHMARK(BM_canada_read_reflect_cpp_avro);
|
||||
|
||||
static void BM_canada_read_reflect_cpp_bson(benchmark::State &state) {
|
||||
const auto data = rfl::bson::write(load_data());
|
||||
for (auto _ : state) {
|
||||
|
||||
Reference in New Issue
Block a user