Skip to content

Commit c592da4

Browse files
authored
Adds yyjson to our internal benchmarks. (simdjson#1244)
1 parent 61fb424 commit c592da4

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@
3737
[submodule "dependencies/boost.json"]
3838
path = dependencies/boost.json
3939
url = https://github.com/CPPAlliance/json.git
40+
[submodule "dependencies/yyjson"]
41+
path = dependencies/yyjson
42+
url = https://github.com/ibireme/yyjson.git

benchmark/parsingcompetition.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "benchmark.h"
1414

1515
SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
16+
#include "yyjson.h"
1617

1718
// #define RAPIDJSON_SSE2 // bad for performance
1819
// #define RAPIDJSON_SSE42 // bad for performance
@@ -190,6 +191,17 @@ bool bench(const char *filename, bool verbose, bool just_data,
190191

191192
BEST_TIME("Boost.json", execute(sv), false, , repeat, volume, !just_data);
192193
}
194+
{
195+
196+
auto execute = [&p]() -> bool {
197+
yyjson_doc *doc = yyjson_read(p.data(), p.size(), 0);
198+
bool is_ok = doc != nullptr;
199+
yyjson_doc_free(doc);
200+
return is_ok;
201+
};
202+
203+
BEST_TIME("yyjson", execute(), true, , repeat, volume, !just_data);
204+
}
193205
#ifndef ALLPARSER
194206
if (!just_data)
195207
#endif

dependencies/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,12 @@ if ((Git_FOUND) AND SIMDJSON_GIT AND (SIMDJSON_IS_UNDER_GIT))
7272
target_compile_definitions(boostjson PUBLIC BOOST_JSON_STANDALONE)
7373
target_include_directories(boostjson PUBLIC boost.json/include)
7474

75+
initialize_submodule(yyjson)
76+
add_library(yyjson yyjson/src/yyjson.c)
77+
target_include_directories(yyjson PUBLIC yyjson/src)
78+
7579
add_library(competition-core INTERFACE)
76-
target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn boostjson)
80+
target_link_libraries(competition-core INTERFACE competition-json competition-rapidjson competition-sajson competition-cJSON competition-jsmn boostjson yyjson)
7781

7882
add_library(competition-all INTERFACE)
7983
target_link_libraries(competition-all INTERFACE competition-core competition-jsoncppdist competition-json11 competition-fastjson competition-gason competition-ujson4c)

dependencies/yyjson

Submodule yyjson added at aa33ec5

0 commit comments

Comments
 (0)