update how boost.json is invoked, fix missing separators (#1203)

* initial try at adding boost json to the benchmark

* clean up

* qualify memcpy etc. with std::

* clang format

* extra space

* update benchmark with help from Vinnie Falco from Boost.json

* add missing separators
This commit is contained in:
Paul Dreik 2020-10-10 00:22:37 +02:00 committed by GitHub
parent b04f64e02c
commit 1d9926698e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -50,6 +50,7 @@
if (verbose) { \
std::printf(" GB/s "); \
} \
std::printf("\t"); \
std::printf("%7.3f", 1.0 / aggregate.best.elapsed_sec()); \
if (verbose) { \
std::printf(" documents/s "); \
@ -96,6 +97,7 @@
if (verbose) { \
std::printf(" GB/s "); \
} \
std::printf("\t"); \
std::printf("%7.3f", 1.0 / aggregate.best.elapsed_sec()); \
if (verbose) { \
std::printf(" documents/s "); \

View File

@ -26,7 +26,8 @@ SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
#include <nlohmann/json.hpp>
using json = nlohmann::json;
#include <boost/json/parse.hpp>
#include <boost/json/parser.hpp>
#include <boost/json/monotonic_resource.hpp>
#ifdef ALLPARSER
@ -176,10 +177,15 @@ bool bench(const char *filename, bool verbose, bool just_data,
{
const boost::json::string_view sv(p.data(), p.size());
auto execute = [](auto sv) -> bool {
boost::json::parser p;
auto execute = [&p](auto sv) -> bool {
boost::json::error_code ec;
auto jv = boost::json::parse(sv, ec);
return !!ec;
boost::json::monotonic_resource mr;
p.reset( &mr );
p.write(sv,ec);
if(!ec)
auto jv=p.release();
return !!ec;
};
BEST_TIME("Boost.json", execute(sv), false, , repeat, volume, !just_data);