File: nlohmann_json.h

package info (click to toggle)
simdjson 4.3.1-5
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 31,396 kB
  • sloc: cpp: 195,760; ansic: 20,954; sh: 1,126; python: 885; makefile: 47; ruby: 25; javascript: 13
file content (24 lines) | stat: -rw-r--r-- 611 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#ifdef SIMDJSON_COMPETITION_NLOHMANN_JSON

#include "large_random.h"

namespace large_random {

struct nlohmann_json {
  static constexpr diff_flags DiffFlags = diff_flags::NONE;

  bool run(simdjson::padded_string &json, std::vector<point> &result) {
    for (auto point : nlohmann::json::parse(json.data(), json.data() + json.size())) {
      result.emplace_back(json_benchmark::point{point["x"], point["y"], point["z"]});
    }
    return true;
  }
};

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

} // namespace large_random

#endif // SIMDJSON_COMPETITION_NLOHMANN_JSON