1010#include < vector>
1111#include < format>
1212#include < atomic>
13- #include < rfl.hpp>
14- #include < rfl/json.hpp>
1513#include " user_profile.hpp"
1614#include " custom_serializer.h"
1715#include " nlohmann_user_profile.hpp"
18-
16+ #if SIMDJSON_BENCH_CPP_REFLECT
17+ #include " benchmark_reflect_serialization.hpp"
18+ #endif
1919std::string generate_email (const std::string &name,
2020 const std::string &company) {
2121 std::string email = name + " @" + company + " .com" ;
@@ -231,21 +231,6 @@ void bench_nlohmann(std::vector<User> &data) {
231231 );
232232}
233233
234- void bench_reflect_cpp (std::vector<User>& data) {
235- std::string output = rfl::json::write (data);
236- size_t output_volume = output.size ();
237- printf (" # output volume: %zu bytes\n " , output_volume);
238-
239- volatile size_t measured_volume = 0 ;
240- pretty_print (
241- 1 , output_volume, " bench_reflect_cpp" ,
242- bench ([&data, &measured_volume, &output_volume] () {
243- std::string output = rfl::json::write (data);
244- measured_volume = output.size ();
245- if (measured_volume != output_volume) { printf (" mismatch\n " ); }
246- })
247- );
248- }
249234
250235
251236int main () {
@@ -257,7 +242,8 @@ int main() {
257242 bench_nlohmann (test_data);
258243 bench_custom (test_data);
259244 bench_fast_simpler (test_data);
245+ #if SIMDJSON_BENCH_CPP_REFLECT
260246 bench_reflect_cpp (test_data);
261-
247+ # endif
262248 return EXIT_SUCCESS;
263249}
0 commit comments