File: boostjson.h

package info (click to toggle)
simdjson 4.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,936 kB
  • sloc: cpp: 171,612; ansic: 19,122; sh: 1,126; python: 842; makefile: 47; ruby: 25; javascript: 13
file content (29 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#ifdef SIMDJSON_COMPETITION_BOOSTJSON

#include "large_random.h"

namespace large_random {

struct boostjson {
  static constexpr diff_flags DiffFlags = diff_flags::IMPRECISE_FLOATS;

  bool run(simdjson::padded_string &json, std::vector<point> &result) {
    auto root = boost::json::parse(json);
    for (const auto &point : root.as_array()) {
      result.emplace_back(json_benchmark::point{
        point.at("x").to_number<double>(),
        point.at("y").to_number<double>(),
        point.at("z").to_number<double>()
      });
    }
    return true;
  }
};

BENCHMARK_TEMPLATE(large_random, boostjson)->UseManualTime();

} // namespace large_random

#endif // SIMDJSON_COMPETITION_BOOSTJSON