Benchmark json_document
benchmarks_view.cpp adds ViewParse, ViewRead (a reused document), ViewParseIndented, ViewAccept, and ViewMaterialize on the files of ParseString, so that each row can be read against the json::parse row of the same file; benchmarks.cpp gains Accept (json::accept) as the counterpart of ViewAccept. The view benchmarks are built only if the header directory has json_view.hpp, so that older versions can still be benchmarked. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
4 files changed
+186
-1
No files matched your search
@@ -38,3 +38,10 @@ target_compile_features(json_benchmarks PRIVATE cxx_std_11)
|
||||
target_link_libraries(json_benchmarks benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
add_dependencies(json_benchmarks download_test_data)
|
||||
target_include_directories(json_benchmarks PRIVATE ${JSON_BENCHMARK_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/include)
|
||||
|
||||
# the json_document benchmarks, unless the header to benchmark predates json_view.hpp
|
||||
if(EXISTS "${JSON_BENCHMARK_INCLUDE_DIR}/nlohmann/json_view.hpp")
|
||||
target_sources(json_benchmarks PRIVATE src/benchmarks_view.cpp)
|
||||
else()
|
||||
message(STATUS "${JSON_BENCHMARK_INCLUDE_DIR} has no nlohmann/json_view.hpp: skipping the json_document benchmarks")
|
||||
endif()
|
||||
Reference in new issue
Block a user