diff -Nru simdjson-0.2.0/.appveyor.yml simdjson-0.2.1/.appveyor.yml --- simdjson-0.2.0/.appveyor.yml 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/.appveyor.yml 2019-08-04 19:43:47.000000000 +0000 @@ -11,12 +11,12 @@ environment: matrix: - - AVXFLAG: "OFF" - - AVXFLAG: "ON" - + - SIMDJSON_BUILD_STATIC: "OFF" + - SIMDJSON_BUILD_STATIC: "ON" + build_script: - mkdir build - cd build - - ps: cmake -DSIMDJSON_DISABLE_AVX="$env:AVXFLAG" -DCMAKE_GENERATOR_PLATFORM=x64 .. + - ps: cmake -DSIMDJSON_BUILD_STATIC="$env:SIMDJSON_BUILD_STATIC" -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_PLATFORM=x64 .. - cmake --build . - ctest --verbose diff -Nru simdjson-0.2.0/benchmark/parsingcompetition.cpp simdjson-0.2.1/benchmark/parsingcompetition.cpp --- simdjson-0.2.0/benchmark/parsingcompetition.cpp 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/benchmark/parsingcompetition.cpp 2019-08-04 19:43:47.000000000 +0000 @@ -20,6 +20,9 @@ #include "sajson.h" +#include +using json = nlohmann::json; + #ifdef ALLPARSER #include "fastjson.cpp" @@ -158,6 +161,11 @@ sajson::mutable_string_view(p.size(), buffer)) .is_valid(), true, memcpy(buffer, p.data(), p.size()), repeat, volume, !just_data); + size_t expected = json::parse(p.data(), p.data() + p.size()).size(); + BEST_TIME("nlohmann-json", json::parse(buffer, buffer + p.size()).size(), + expected, memcpy(buffer, p.data(), p.size()), repeat, volume, + !just_data); + #ifdef ALLPARSER std::string json11err; BEST_TIME("dropbox (json11) ", diff -Nru simdjson-0.2.0/CMakeLists.txt simdjson-0.2.1/CMakeLists.txt --- simdjson-0.2.0/CMakeLists.txt 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/CMakeLists.txt 2019-08-04 19:43:47.000000000 +0000 @@ -20,8 +20,8 @@ set(SIMDJSON_LIB_NAME simdjson) set(PROJECT_VERSION_MAJOR 0) set(PROJECT_VERSION_MINOR 2) -set(PROJECT_VERSION_PATCH 0) -set(SIMDJSON_LIB_VERSION "0.2.0" CACHE STRING "simdjson library version") +set(PROJECT_VERSION_PATCH 1) +set(SIMDJSON_LIB_VERSION "0.2.1" CACHE STRING "simdjson library version") set(SIMDJSON_LIB_SOVERSION "0" CACHE STRING "simdjson library soversion") if(NOT MSVC) diff -Nru simdjson-0.2.0/debian/changelog simdjson-0.2.1/debian/changelog --- simdjson-0.2.0/debian/changelog 2019-08-02 01:11:15.000000000 +0000 +++ simdjson-0.2.1/debian/changelog 2019-08-08 11:59:26.000000000 +0000 @@ -1,3 +1,10 @@ +simdjson (0.2.1-1) unstable; urgency=medium + + * New upstream version 0.2.1 + * Refresh symbols list. + + -- Mo Zhou Thu, 08 Aug 2019 11:59:26 +0000 + simdjson (0.2.0-1) unstable; urgency=medium * New upstream version 0.2.0 diff -Nru simdjson-0.2.0/debian/libsimdjson0.symbols simdjson-0.2.1/debian/libsimdjson0.symbols --- simdjson-0.2.0/debian/libsimdjson0.symbols 2019-08-02 00:58:50.000000000 +0000 +++ simdjson-0.2.1/debian/libsimdjson0.symbols 2019-08-08 10:46:57.000000000 +0000 @@ -24,6 +24,8 @@ _ZN8simdjson10ParsedJsonD1Ev@Base 0.2.0 _ZN8simdjson10ParsedJsonD2Ev@Base 0.2.0 _ZN8simdjson10get_corpusERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.0 + _ZN8simdjson10json_parseEPKcmRNS_10ParsedJsonEb@Base 0.2.1 + _ZN8simdjson10json_parseEPKhmRNS_10ParsedJsonEb@Base 0.2.1 _ZN8simdjson11json_minifyEPKhmPh@Base 0.2.0 _ZN8simdjson13error_messageB5cxx11Ei@Base 0.2.0 _ZN8simdjson14json_parse_ptrE@Base 0.2.0 diff -Nru simdjson-0.2.0/debian/libsimdjson0.symbols.arm64 simdjson-0.2.1/debian/libsimdjson0.symbols.arm64 --- simdjson-0.2.0/debian/libsimdjson0.symbols.arm64 2019-08-02 01:01:37.000000000 +0000 +++ simdjson-0.2.1/debian/libsimdjson0.symbols.arm64 2019-08-08 11:56:56.000000000 +0000 @@ -24,6 +24,8 @@ _ZN8simdjson10ParsedJsonD1Ev@Base 0.2.0 _ZN8simdjson10ParsedJsonD2Ev@Base 0.2.0 _ZN8simdjson10get_corpusERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE@Base 0.2.0 + _ZN8simdjson10json_parseEPKcmRNS_10ParsedJsonEb@Base 0.2.1 + _ZN8simdjson10json_parseEPKhmRNS_10ParsedJsonEb@Base 0.2.1 _ZN8simdjson11json_minifyEPKhmPh@Base 0.2.0 _ZN8simdjson13error_messageB5cxx11Ei@Base 0.2.0 _ZN8simdjson14json_parse_ptrE@Base 0.2.0 diff -Nru simdjson-0.2.0/.drone.yml simdjson-0.2.1/.drone.yml --- simdjson-0.2.0/.drone.yml 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/.drone.yml 2019-08-04 19:43:47.000000000 +0000 @@ -44,7 +44,7 @@ - ./style/run-clang-format.py -r include/ benchmark/ src/ tests/ --- kind: pipeline -name: amd64_clang_cmake +name: amd64_clang_cmake_dynamic platform: os: linux @@ -61,12 +61,34 @@ - apt-get install -y make $CC g++ cmake - $CC --version - mkdir build && cd build - - cmake $CMAKE_FLAGS .. + - cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS .. + - make -j + - ctest +--- +kind: pipeline +name: amd64_clang_cmake_static + +platform: + os: linux + arch: amd64 + +steps: +- name: Build and Test + image: ubuntu:18.04 + environment: + CC: clang + CXX: clang++ + commands: + - apt-get update -y + - apt-get install -y make $CC g++ cmake + - $CC --version + - mkdir build && cd build + - cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS .. - make -j - ctest --- kind: pipeline -name: amd64_gcc_cmake +name: amd64_gcc_cmake_static platform: os: linux @@ -83,12 +105,34 @@ - apt-get install -y make $CC g++ cmake - $CC --version - mkdir build && cd build - - cmake $CMAKE_FLAGS .. + - cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS .. + - make -j + - ctest +--- +kind: pipeline +name: amd64_gcc_cmake_dynamic + +platform: + os: linux + arch: amd64 + +steps: +- name: Build and Test + image: ubuntu:18.04 + environment: + CC: gcc + CXX: g++ + commands: + - apt-get update -y + - apt-get install -y make $CC g++ cmake + - $CC --version + - mkdir build && cd build + - cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS .. - make -j - ctest --- kind: pipeline -name: arm64_clang_cmake +name: arm64_clang_cmake_dynamic platform: os: linux @@ -105,12 +149,12 @@ - apt-get install -y make $CC g++ cmake - $CC --version - mkdir build && cd build - - cmake $CMAKE_FLAGS .. + - cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS .. - make -j - ctest --- kind: pipeline -name: arm64_gcc_cmake +name: arm64_gcc_cmake_dynamic platform: os: linux @@ -130,3 +174,61 @@ - cmake $CMAKE_FLAGS .. - make -j - ctest + + commands: + - apt-get update -y + - apt-get install -y make $CC g++ cmake + - $CC --version + - mkdir build && cd build + - cmake -DSIMDJSON_BUILD_STATIC=OFF $CMAKE_FLAGS .. + - make -j + - ctest +--- +kind: pipeline +name: arm64_clang_cmake_static + +platform: + os: linux + arch: arm64 + +steps: +- name: Build and Test + image: ubuntu:18.04 + environment: + CC: clang + CXX: clang++ + commands: + - apt-get update -y + - apt-get install -y make $CC g++ cmake + - $CC --version + - mkdir build && cd build + - cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS .. + - make -j + - ctest +--- +kind: pipeline +name: arm64_gcc_cmake_static + +platform: + os: linux + arch: arm64 + +steps: +- name: Build and Test + image: ubuntu:18.04 + environment: + CC: gcc + CXX: g++ + commands: + - apt-get update -y + - apt-get install -y make $CC g++ cmake + - $CC --version + - mkdir build && cd build + - cmake -DSIMDJSON_BUILD_STATIC=ON $CMAKE_FLAGS .. + - make -j + - ctest + + + + + diff -Nru simdjson-0.2.0/.gitmodules simdjson-0.2.1/.gitmodules --- simdjson-0.2.0/.gitmodules 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/.gitmodules 2019-08-04 19:43:47.000000000 +0000 @@ -25,3 +25,6 @@ [submodule "dependencies/jsoncpp"] path = dependencies/jsoncpp url = https://github.com/open-source-parsers/jsoncpp.git +[submodule "dependencies/json"] + path = dependencies/json + url = https://github.com/nlohmann/json.git diff -Nru simdjson-0.2.0/include/simdjson/jsonparser.h simdjson-0.2.1/include/simdjson/jsonparser.h --- simdjson-0.2.0/include/simdjson/jsonparser.h 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/include/simdjson/jsonparser.h 2019-08-04 19:43:47.000000000 +0000 @@ -17,18 +17,6 @@ #endif namespace simdjson { -// The function that users are expected to call is json_parse. -// We have more than one such function because we want to support several -// instruction sets. - -// function pointer type for json_parse -using json_parse_functype = int(const uint8_t *buf, size_t len, ParsedJson &pj, - bool realloc_if_needed); - -// Pointer that holds the json_parse implementation corresponding to the -// available SIMD instruction set -extern json_parse_functype *json_parse_ptr; - // json_parse_implementation is the generic function, it is specialized for // various architectures, e.g., as // json_parse_implementation or @@ -42,7 +30,7 @@ bool reallocated = false; if (realloc_if_needed) { #if ALLOW_SAME_PAGE_BUFFER_OVERRUN - // realloc is needed if the end of the memory crosses a page +// realloc is needed if the end of the memory crosses a page #ifdef _MSC_VER SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); @@ -110,10 +98,8 @@ // realloc_if_needed is false, all bytes at and after buf + len are ignored // (can be garbage). The ParsedJson object can be reused. -inline int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, - bool realloc_if_needed = true) { - return json_parse_ptr(buf, len, pj, realloc_if_needed); -} +int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed = true); // Parse a document found in buf. // @@ -139,11 +125,8 @@ // buf should be readable up to buf + len + SIMDJSON_PADDING if // realloc_if_needed is false, all bytes at and after buf + len are ignored // (can be garbage). The ParsedJson object can be reused. -inline int json_parse(const char *buf, size_t len, ParsedJson &pj, - bool realloc_if_needed = true) { - return json_parse_ptr(reinterpret_cast(buf), len, pj, - realloc_if_needed); -} +int json_parse(const char *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed = true); // We do not want to allow implicit conversion from C string to std::string. int json_parse(const char *buf, ParsedJson &pj) = delete; diff -Nru simdjson-0.2.0/include/simdjson/simdjson_version.h simdjson-0.2.1/include/simdjson/simdjson_version.h --- simdjson-0.2.0/include/simdjson/simdjson_version.h 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/include/simdjson/simdjson_version.h 2019-08-04 19:43:47.000000000 +0000 @@ -2,12 +2,12 @@ // do not change by hand #ifndef SIMDJSON_INCLUDE_SIMDJSON_VERSION #define SIMDJSON_INCLUDE_SIMDJSON_VERSION -#define SIMDJSON_VERSION 0.2.0 +#define SIMDJSON_VERSION 0.2.1 namespace simdjson { enum { - SIMDJSON_VERSION_MAJOR = 0, - SIMDJSON_VERSION_MINOR = 2, - SIMDJSON_VERSION_REVISION = 0 + SIMDJSON_VERSION_MAJOR = 0, + SIMDJSON_VERSION_MINOR = 2, + SIMDJSON_VERSION_REVISION = 1 }; } #endif // SIMDJSON_INCLUDE_SIMDJSON_VERSION diff -Nru simdjson-0.2.0/Makefile simdjson-0.2.1/Makefile --- simdjson-0.2.0/Makefile 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/Makefile 2019-08-04 19:43:47.000000000 +0000 @@ -5,7 +5,7 @@ .PHONY: clean cleandist -COREDEPSINCLUDE = -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/cJSON -Idependencies/jsmn +COREDEPSINCLUDE = -Idependencies/json/single_include -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/cJSON -Idependencies/jsmn EXTRADEPSINCLUDE = -Idependencies/jsoncppdist -Idependencies/json11 -Idependencies/fastjson/src -Idependencies/fastjson/include -Idependencies/gason/src -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src # users can provide their own additional flags with make EXTRAFLAGS=something architecture:=$(shell arch) @@ -76,9 +76,9 @@ UJSON4C_INCLUDE:=dependencies/ujson4c/src/ujdecode.c CJSON_INCLUDE:=dependencies/cJSON/cJSON.h JSMN_INCLUDE:=dependencies/jsmn/jsmn.h +JSON_INCLUDE:=dependencies/json/single_include/nlohmann/json.hpp - -LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE) $(CJSON_INCLUDE) $(JSMN_INCLUDE) +LIBS=$(RAPIDJSON_INCLUDE) $(JSON_INCLUDE) $(SAJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE) $(CJSON_INCLUDE) $(JSMN_INCLUDE) EXTRAOBJECTS=ujdecode.o all: $(MAINEXECUTABLES) @@ -118,7 +118,7 @@ -git submodule update --init --recursive -touch submodules -$(SAJSON_INCLUDE) $(RAPIDJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE) $(CJSON_INCLUDE) $(JSMN_INCLUDE) : submodules +$(JSON_INCLUDE) $(SAJSON_INCLUDE) $(RAPIDJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE) $(CJSON_INCLUDE) $(JSMN_INCLUDE) : submodules parse: benchmark/parse.cpp $(HEADERS) $(LIBFILES) $(CXX) $(CXXFLAGS) -o parse $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS) @@ -179,6 +179,7 @@ $(CXX) $(CXXFLAGS) -o distinctuseridcompetition $(LIBFILES) benchmark/distinctuseridcompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE) parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES) submodules + @echo "In case of build error due to missing files, try 'make clean'" $(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE) allparsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES) $(EXTRAOBJECTS) submodules diff -Nru simdjson-0.2.0/README.md simdjson-0.2.1/README.md --- simdjson-0.2.0/README.md 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/README.md 2019-08-04 19:43:47.000000000 +0000 @@ -48,6 +48,7 @@ | ultrajson | 0.42 | | jsmn | 0.28 | | cJSON | 0.34 | +| JSON for Modern C++ (nlohmann/json) | 0.10 | ## Requirements @@ -188,6 +189,10 @@ We also support 64-bit ARM. We assume NEON support, and if the cryptographic extension is available, we leverage it, at compile-time. There is no runtime dispatch on ARM. +## Thread safety + +The simdjson library is single-threaded and thread safety is the responsability of the caller. If you are on an x64 processor, the runtime dispatching assigns the right code path the firs time that parsing is attempted. For safety, you should always call json_parse at least once in a single-threaded context. + ## Usage (old-school Makefile on platforms like Linux or macOS) diff -Nru simdjson-0.2.0/singleheader/amalgamation_demo.cpp simdjson-0.2.1/singleheader/amalgamation_demo.cpp --- simdjson-0.2.0/singleheader/amalgamation_demo.cpp 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/singleheader/amalgamation_demo.cpp 2019-08-04 19:43:47.000000000 +0000 @@ -1,4 +1,4 @@ -/* auto-generated on Thu 1 Aug 2019 16:18:07 EDT. Do not edit! */ +/* auto-generated on Sun Aug 4 15:43:41 EDT 2019. Do not edit! */ #include #include "simdjson.h" diff -Nru simdjson-0.2.0/singleheader/simdjson.cpp simdjson-0.2.1/singleheader/simdjson.cpp --- simdjson-0.2.0/singleheader/simdjson.cpp 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/singleheader/simdjson.cpp 2019-08-04 19:43:47.000000000 +0000 @@ -1,4 +1,4 @@ -/* auto-generated on Thu 1 Aug 2019 16:18:07 EDT. Do not edit! */ +/* auto-generated on Sun Aug 4 15:43:41 EDT 2019. Do not edit! */ #include "simdjson.h" /* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */ @@ -362,6 +362,29 @@ namespace simdjson { +// The function that users are expected to call is json_parse. +// We have more than one such function because we want to support several +// instruction sets. + +// function pointer type for json_parse +using json_parse_functype = int(const uint8_t *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed); + +// Pointer that holds the json_parse implementation corresponding to the +// available SIMD instruction set +extern json_parse_functype *json_parse_ptr; + +int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed) { + return json_parse_ptr(buf, len, pj, realloc_if_needed); +} + +int json_parse(const char *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed) { + return json_parse_ptr(reinterpret_cast(buf), len, pj, + realloc_if_needed); +} + Architecture find_best_supported_implementation() { constexpr uint32_t haswell_flags = instruction_set::AVX2 | instruction_set::PCLMULQDQ | diff -Nru simdjson-0.2.0/singleheader/simdjson.h simdjson-0.2.1/singleheader/simdjson.h --- simdjson-0.2.0/singleheader/simdjson.h 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/singleheader/simdjson.h 2019-08-04 19:43:47.000000000 +0000 @@ -1,15 +1,18 @@ -/* auto-generated on Thu 1 Aug 2019 16:18:07 EDT. Do not edit! */ +/* auto-generated on Sun Aug 4 15:43:41 EDT 2019. Do not edit! */ /* begin file include/simdjson/simdjson_version.h */ -// /include/simdjson/simdjson_version.h automatically generated by release.py, do not change by hand -#ifndef SIMDJSON_INCLUDE_SIMDJSON_VERSION -#define SIMDJSON_INCLUDE_SIMDJSON_VERSION -#define SIMDJSON_VERSION 0.2.0 -enum { - SIMDJSON_VERSION_MAJOR = 0, - SIMDJSON_VERSION_MINOR = 2, - SIMDJSON_VERSION_REVISION = 0 -}; -#endif // SIMDJSON_INCLUDE_SIMDJSON_VERSION +// /include/simdjson/simdjson_version.h automatically generated by release.py, +// do not change by hand +#ifndef SIMDJSON_INCLUDE_SIMDJSON_VERSION +#define SIMDJSON_INCLUDE_SIMDJSON_VERSION +#define SIMDJSON_VERSION 0.2.1 +namespace simdjson { +enum { + SIMDJSON_VERSION_MAJOR = 0, + SIMDJSON_VERSION_MINOR = 2, + SIMDJSON_VERSION_REVISION = 1 +}; +} +#endif // SIMDJSON_INCLUDE_SIMDJSON_VERSION /* end file include/simdjson/simdjson_version.h */ /* begin file include/simdjson/portability.h */ #ifndef SIMDJSON_PORTABILITY_H @@ -37507,8 +37510,7 @@ #endif // SIMDJSON_NAIVE_FLATTEN } // namespace simdjson -#endif // SIMDJSON_STAGE1_FIND_MARKS_FLATTEN_H -/* end file include/simdjson/stage1_find_marks_flatten.h */ +#endif // SIMDJSON_STAGE1_FIND_MARKS_FLATTEN_H/* end file include/simdjson/stage1_find_marks_flatten.h */ /* begin file include/simdjson/stage1_find_marks_flatten_haswell.h */ #ifndef SIMDJSON_STAGE1_FIND_MARKS_FLATTEN_HASWELL_H #define SIMDJSON_STAGE1_FIND_MARKS_FLATTEN_HASWELL_H @@ -37843,8 +37845,7 @@ return check_utf8_errors(utf8_state); \ } -#endif // SIMDJSON_STAGE1_FIND_MARKS_MACROS_H -/* end file include/simdjson/stage1_find_marks_macros.h */ +#endif // SIMDJSON_STAGE1_FIND_MARKS_MACROS_H/* end file include/simdjson/stage1_find_marks_macros.h */ /* begin file include/simdjson/stage1_find_marks_westmere.h */ #ifndef SIMDJSON_STAGE1_FIND_MARKS_WESTMERE_H #define SIMDJSON_STAGE1_FIND_MARKS_WESTMERE_H @@ -38035,8 +38036,7 @@ UNTARGET_REGION #endif // IS_X86_64 -#endif // SIMDJSON_STAGE1_FIND_MARKS_WESTMERE_H -/* end file include/simdjson/stage1_find_marks_westmere.h */ +#endif // SIMDJSON_STAGE1_FIND_MARKS_WESTMERE_H/* end file include/simdjson/stage1_find_marks_westmere.h */ /* begin file include/simdjson/stage1_find_marks_haswell.h */ #ifndef SIMDJSON_STAGE1_FIND_MARKS_HASWELL_H #define SIMDJSON_STAGE1_FIND_MARKS_HASWELL_H @@ -38243,8 +38243,7 @@ UNTARGET_REGION #endif // IS_X86_64 -#endif // SIMDJSON_STAGE1_FIND_MARKS_HASWELL_H -/* end file include/simdjson/stage1_find_marks_haswell.h */ +#endif // SIMDJSON_STAGE1_FIND_MARKS_HASWELL_H/* end file include/simdjson/stage1_find_marks_haswell.h */ /* begin file include/simdjson/stage1_find_marks_arm64.h */ #ifndef SIMDJSON_STAGE1_FIND_MARKS_ARM64_H #define SIMDJSON_STAGE1_FIND_MARKS_ARM64_H @@ -38451,8 +38450,7 @@ } // namespace simdjson #endif // IS_ARM64 -#endif // SIMDJSON_STAGE1_FIND_MARKS_ARM64_H -/* end file include/simdjson/stage1_find_marks_arm64.h */ +#endif // SIMDJSON_STAGE1_FIND_MARKS_ARM64_H/* end file include/simdjson/stage1_find_marks_arm64.h */ /* begin file include/simdjson/stringparsing.h */ #ifndef SIMDJSON_STRINGPARSING_H #define SIMDJSON_STRINGPARSING_H @@ -38642,8 +38640,7 @@ return true; \ } -#endif -/* end file include/simdjson/stringparsing_macros.h */ +#endif/* end file include/simdjson/stringparsing_macros.h */ /* begin file include/simdjson/stringparsing_westmere.h */ #ifndef SIMDJSON_STRINGPARSING_WESTMERE_H #define SIMDJSON_STRINGPARSING_WESTMERE_H @@ -38683,8 +38680,7 @@ UNTARGET_REGION #endif -#endif -/* end file include/simdjson/stringparsing_westmere.h */ +#endif/* end file include/simdjson/stringparsing_westmere.h */ /* begin file include/simdjson/stringparsing_haswell.h */ #ifndef SIMDJSON_STRINGPARSING_HASWELL_H #define SIMDJSON_STRINGPARSING_HASWELL_H @@ -38726,8 +38722,7 @@ UNTARGET_REGION #endif -#endif -/* end file include/simdjson/stringparsing_haswell.h */ +#endif/* end file include/simdjson/stringparsing_haswell.h */ /* begin file include/simdjson/stringparsing_arm64.h */ #ifndef SIMDJSON_STRINGPARSING_ARM64_H #define SIMDJSON_STRINGPARSING_ARM64_H @@ -39463,18 +39458,6 @@ #endif namespace simdjson { -// The function that users are expected to call is json_parse. -// We have more than one such function because we want to support several -// instruction sets. - -// function pointer type for json_parse -using json_parse_functype = int(const uint8_t *buf, size_t len, ParsedJson &pj, - bool realloc_if_needed); - -// Pointer that holds the json_parse implementation corresponding to the -// available SIMD instruction set -extern json_parse_functype *json_parse_ptr; - // json_parse_implementation is the generic function, it is specialized for // various architectures, e.g., as // json_parse_implementation or @@ -39488,7 +39471,7 @@ bool reallocated = false; if (realloc_if_needed) { #if ALLOW_SAME_PAGE_BUFFER_OVERRUN - // realloc is needed if the end of the memory crosses a page +// realloc is needed if the end of the memory crosses a page #ifdef _MSC_VER SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); @@ -39556,10 +39539,8 @@ // realloc_if_needed is false, all bytes at and after buf + len are ignored // (can be garbage). The ParsedJson object can be reused. -inline int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, - bool realloc_if_needed = true) { - return json_parse_ptr(buf, len, pj, realloc_if_needed); -} +int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed = true); // Parse a document found in buf. // @@ -39585,11 +39566,8 @@ // buf should be readable up to buf + len + SIMDJSON_PADDING if // realloc_if_needed is false, all bytes at and after buf + len are ignored // (can be garbage). The ParsedJson object can be reused. -inline int json_parse(const char *buf, size_t len, ParsedJson &pj, - bool realloc_if_needed = true) { - return json_parse_ptr(reinterpret_cast(buf), len, pj, - realloc_if_needed); -} +int json_parse(const char *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed = true); // We do not want to allow implicit conversion from C string to std::string. int json_parse(const char *buf, ParsedJson &pj) = delete; diff -Nru simdjson-0.2.0/src/jsonparser.cpp simdjson-0.2.1/src/jsonparser.cpp --- simdjson-0.2.0/src/jsonparser.cpp 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/src/jsonparser.cpp 2019-08-04 19:43:47.000000000 +0000 @@ -5,6 +5,29 @@ namespace simdjson { +// The function that users are expected to call is json_parse. +// We have more than one such function because we want to support several +// instruction sets. + +// function pointer type for json_parse +using json_parse_functype = int(const uint8_t *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed); + +// Pointer that holds the json_parse implementation corresponding to the +// available SIMD instruction set +extern json_parse_functype *json_parse_ptr; + +int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed) { + return json_parse_ptr(buf, len, pj, realloc_if_needed); +} + +int json_parse(const char *buf, size_t len, ParsedJson &pj, + bool realloc_if_needed) { + return json_parse_ptr(reinterpret_cast(buf), len, pj, + realloc_if_needed); +} + Architecture find_best_supported_implementation() { constexpr uint32_t haswell_flags = instruction_set::AVX2 | instruction_set::PCLMULQDQ | diff -Nru simdjson-0.2.0/style/run-clang-format.py simdjson-0.2.1/style/run-clang-format.py --- simdjson-0.2.0/style/run-clang-format.py 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/style/run-clang-format.py 2019-08-04 19:43:47.000000000 +0000 @@ -322,4 +322,5 @@ if __name__ == '__main__': - sys.exit(main()) + #sys.exit(main()) + main() # we don't want a hard failure on a style check. diff -Nru simdjson-0.2.0/tests/CMakeLists.txt simdjson-0.2.1/tests/CMakeLists.txt --- simdjson-0.2.0/tests/CMakeLists.txt 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/tests/CMakeLists.txt 2019-08-04 19:43:47.000000000 +0000 @@ -12,4 +12,14 @@ # add_executable(singleheader ./singleheadertest.cpp ${PROJECT_SOURCE_DIR}/singleheader/simdjson.cpp) # target_compile_definitions(singleheader PRIVATE JSON_TEST_PATH="${PROJECT_SOURCE_DIR}/jsonexamples/twitter.json") # target_link_libraries(singleheader ${SIMDJSON_LIB_NAME}) -# add_test(singleheader singleheader) \ No newline at end of file +# add_test(singleheader singleheader) + +if(MSVC) + add_custom_command(TARGET basictests POST_BUILD # Adds a post-build event + COMMAND ${CMAKE_COMMAND} -E echo "$" + COMMAND ${CMAKE_COMMAND} -E echo "$" + COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake -E copy_if_different..." + "$" # <--this is in-file + "$") # <--this is out-file path +endif() + diff -Nru simdjson-0.2.0/tools/release.py simdjson-0.2.1/tools/release.py --- simdjson-0.2.0/tools/release.py 2019-08-01 20:23:30.000000000 +0000 +++ simdjson-0.2.1/tools/release.py 2019-08-04 19:43:47.000000000 +0000 @@ -89,9 +89,9 @@ file.write("#define SIMDJSON_VERSION "+toversionstring(*newversion)+"\n") file.write("namespace simdjson {\n") file.write("enum {\n") - file.write(" SIMDJSON_VERSION_MAJOR = "+str(newversion[0])+",\n") - file.write(" SIMDJSON_VERSION_MINOR = "+str(newversion[1])+",\n") - file.write(" SIMDJSON_VERSION_REVISION = "+str(newversion[2])+"\n") + file.write(" SIMDJSON_VERSION_MAJOR = "+str(newversion[0])+",\n") + file.write(" SIMDJSON_VERSION_MINOR = "+str(newversion[1])+",\n") + file.write(" SIMDJSON_VERSION_REVISION = "+str(newversion[2])+"\n") file.write("};\n") file.write("}\n") file.write("#endif // SIMDJSON_INCLUDE_SIMDJSON_VERSION\n")