diff --git a/.gitmodules b/.gitmodules index a66342b0f..a3452d3f6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,3 +37,6 @@ [submodule "dependencies/boost.json"] path = dependencies/boost.json url = https://github.com/CPPAlliance/json.git +[submodule "dependencies/yyjson"] + path = dependencies/yyjson + url = https://github.com/ibireme/yyjson.git diff --git a/benchmark/parsingcompetition.cpp b/benchmark/parsingcompetition.cpp index de11a4971..104de1d87 100644 --- a/benchmark/parsingcompetition.cpp +++ b/benchmark/parsingcompetition.cpp @@ -13,6 +13,7 @@ #include "benchmark.h" SIMDJSON_PUSH_DISABLE_ALL_WARNINGS +#include "yyjson.h" // #define RAPIDJSON_SSE2 // bad for performance // #define RAPIDJSON_SSE42 // bad for performance @@ -190,6 +191,17 @@ bool bench(const char *filename, bool verbose, bool just_data, BEST_TIME("Boost.json", execute(sv), false, , repeat, volume, !just_data); } + { + + auto execute = [&p]() -> bool { + yyjson_doc *doc = yyjson_read(p.data(), p.size(), 0); + bool is_ok = doc != nullptr; + yyjson_doc_free(doc); + return is_ok; + }; + + BEST_TIME("yyjson", execute(), true, , repeat, volume, !just_data); + } #ifndef ALLPARSER if (!just_data) #endif diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 84e1b8d43..3dd02758e 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -72,8 +72,12 @@ if ((Git_FOUND) AND SIMDJSON_GIT AND (SIMDJSON_IS_UNDER_GIT)) target_compile_definitions(boostjson PUBLIC BOOST_JSON_STANDALONE) target_include_directories(boostjson PUBLIC boost.json/include) + initialize_submodule(yyjson) + add_library(yyjson yyjson/src/yyjson.c) + target_include_directories(yyjson PUBLIC yyjson/src) + add_library(competition-core INTERFACE) - target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn boostjson) + target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn boostjson yyjson) add_library(competition-all INTERFACE) target_link_libraries(competition-all INTERFACE competition-core competition-jsoncppdist competition-json11 competition-fastjson competition-gason competition-ujson4c) diff --git a/dependencies/yyjson b/dependencies/yyjson new file mode 160000 index 000000000..aa33ec5a4 --- /dev/null +++ b/dependencies/yyjson @@ -0,0 +1 @@ +Subproject commit aa33ec5a4769ce38078a5bdeecbdacfdf1cad8fb