| 201 | } |
| 202 | |
| 203 | int main(int argc, char **argv) { |
| 204 | benchmark::Initialize(&argc, argv); |
| 205 | |
| 206 | // Read the data from json files |
| 207 | std::vector<std::pair<std::filesystem::path, std::string>> jsons; |
| 208 | for (const auto &entry : std::filesystem::directory_iterator("testdata")) |
| 209 | if (entry.path().extension() == ".json") |
| 210 | jsons.push_back( |
| 211 | std::make_pair(entry.path(), get_json(entry.path().string()))); |
| 212 | |
| 213 | regitser_OnDemand(); |
| 214 | #define ADD_JSON_BMK(JSON, ACT) \ |
| 215 | do { \ |
| 216 | benchmark::RegisterBenchmark( \ |
| 217 | (json.first.stem().string() + ("/" #ACT "_" #JSON)).c_str(), \ |
| 218 | BM_##ACT<JSON, JSON##ParseResult, JSON##StringResult>, \ |
| 219 | json.first.string(), json.second); \ |
| 220 | } while (0) |
| 221 | |
| 222 | #define ADD_BMK(METHOD) \ |
| 223 | do { \ |
| 224 | for (const auto &json : jsons) { \ |
| 225 | ADD_JSON_BMK(SonicDyn, METHOD); \ |
| 226 | ADD_JSON_BMK(Rapidjson, METHOD); \ |
| 227 | ADD_JSON_BMK(YYjson, METHOD); \ |
| 228 | ADD_JSON_BMK(SIMDjson, METHOD); \ |
| 229 | ADD_JSON_BMK(JsonCpp, METHOD); \ |
| 230 | } \ |
| 231 | } while (0) |
| 232 | |
| 233 | ADD_BMK(Decode); |
| 234 | ADD_BMK(Encode); |
| 235 | // ADD_BMK(Stat); |
| 236 | // ADD_BMK(Find); |
| 237 | do { |
| 238 | for (const auto &json : jsons) { |
| 239 | ADD_JSON_BMK(SonicDyn, Stat); |
| 240 | ADD_JSON_BMK(SonicDyn, Find); |
| 241 | ADD_JSON_BMK(Rapidjson, Stat); |
| 242 | ADD_JSON_BMK(Rapidjson, Find); |
| 243 | } |
| 244 | } while (0); |
| 245 | |
| 246 | benchmark::RunSpecifiedBenchmarks(); |
| 247 | benchmark::Shutdown(); |
| 248 | return 0; |
| 249 | } |
nothing calls this directly
no test coverage detected