-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbenchmark_casablanca.cpp
36 lines (35 loc) · 990 Bytes
/
benchmark_casablanca.cpp
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
30
31
32
33
34
35
36
//
// Copyright (C) 2013 Mateusz Loskot <[email protected]>
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include "json_benchmark.hpp"
#include <json.h> // casablanca
namespace jb = jsonbench;
namespace wj = web::json;
int main()
{
try
{
//auto const jsons = jb::get_one_json_per_line();
auto const jsons = jb::get_json();
auto const marks = jb::benchmark(jsons, [](std::string const& s) {
std::stringstream ss;
ss << s;
wj::value jv = wj::value::parse(ss);
#ifdef JSON_BENCHMARK_DUMP_PARSED_JSON
jv.serialize(std::cout);
#endif
return !jv.is_null();
});
jb::print_result(std::cout << "casablanca: ", marks);
return EXIT_SUCCESS;
}
catch (std::exception const& e)
{
std::cerr << e.what() <<std::endl;
}
return EXIT_FAILURE;
}