From 375dfacbf6734e46b6ea21be8c52a6672a09bb4d Mon Sep 17 00:00:00 2001 From: qicosmos Date: Mon, 24 Jul 2023 17:50:38 +0800 Subject: [PATCH] option SEQUENTIAL_PARSE --- CMakeLists.txt | 5 +++++ benchmark/json_benchmark.cpp | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c9dc967..182ac99d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,11 @@ message(STATUS "C++ standard: ${CMAKE_CXX_STANDARD}") add_definitions(-DTHROW_UNKNOWN_KEY) +option(ENABLE_SEQUENTIAL_PARSE "parse json sequential more efficient if the json fields sequences are the same with struct fields" OFF) +if (${ENABLE_SEQUENTIAL_PARSE}) + ADD_DEFINITIONS(-DSEQUENTIAL_PARSE) +endif () + option(HAS_RAPIDJSON "import rapidjson" OFF) if (${HAS_RAPIDJSON}) add_definitions(-DHAS_RAPIDJSON) diff --git a/benchmark/json_benchmark.cpp b/benchmark/json_benchmark.cpp index 4aeefc39..8aca099f 100644 --- a/benchmark/json_benchmark.cpp +++ b/benchmark/json_benchmark.cpp @@ -1,4 +1,3 @@ -#define SEQUENTIAL_PARSE #include "json_benchmark.h" class ScopedTimer {