Added support for Apache Avro, and thus for schemaful formats (#303)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2024-12-22 14:53:25 +01:00
committed by GitHub
parent a1920a1e30
commit e46835287f
114 changed files with 4750 additions and 261 deletions
+13
View File
@@ -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) {