mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd9628df93 | |||
| 99a153d9e8 | |||
| 04da71c3a1 | |||
| 0c86dd9d8d | |||
| 349068dcda | |||
| 144b10b35d | |||
| 44722bddcf | |||
| 2a240e3fe2 |
+4
-4
@@ -11,12 +11,12 @@ platform:
|
||||
|
||||
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
|
||||
|
||||
+109
-7
@@ -44,7 +44,7 @@ steps:
|
||||
- ./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 @@ steps:
|
||||
- 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_gcc_cmake
|
||||
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_static
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
@@ -83,12 +105,34 @@ steps:
|
||||
- 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: arm64_clang_cmake
|
||||
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_dynamic
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
@@ -105,12 +149,12 @@ steps:
|
||||
- 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 @@ steps:
|
||||
- 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ project(simdjson)
|
||||
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)
|
||||
|
||||
@@ -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 @@ GASON_INCLUDE:=dependencies/gason/src/gason.h
|
||||
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 @@ submodules:
|
||||
-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 @@ distinctuseridcompetition: benchmark/distinctuseridcompetition.cpp $(HEADERS) $(
|
||||
$(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
|
||||
|
||||
@@ -48,6 +48,7 @@ On a Skylake processor, the parsing speeds (in GB/s) of various processors on th
|
||||
| ultrajson | 0.42 |
|
||||
| jsmn | 0.28 |
|
||||
| cJSON | 0.34 |
|
||||
| JSON for Modern C++ (nlohmann/json) | 0.10 |
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -188,6 +189,10 @@ sometimes called runtime dispatch).
|
||||
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)
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
#include "sajson.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
using json = nlohmann::json;
|
||||
|
||||
#ifdef ALLPARSER
|
||||
|
||||
#include "fastjson.cpp"
|
||||
@@ -158,6 +161,11 @@ int main(int argc, char *argv[]) {
|
||||
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) ",
|
||||
|
||||
+1
Submodule dependencies/json added at a015b78e81
@@ -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<Architecture::HASWELL> or
|
||||
@@ -42,7 +30,7 @@ int json_parse_implementation(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
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 @@ int json_parse_implementation(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
// 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 @@ inline int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
// 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<const uint8_t *>(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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <iostream>
|
||||
#include "simdjson.h"
|
||||
|
||||
@@ -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 @@ size_t json_minify(const uint8_t *buf, size_t len, uint8_t *out) {
|
||||
|
||||
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<const uint8_t *>(buf), len, pj,
|
||||
realloc_if_needed);
|
||||
}
|
||||
|
||||
Architecture find_best_supported_implementation() {
|
||||
constexpr uint32_t haswell_flags =
|
||||
instruction_set::AVX2 | instruction_set::PCLMULQDQ |
|
||||
|
||||
+27
-49
@@ -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 @@ really_inline void flatten_bits(uint32_t *base_ptr, uint32_t &base,
|
||||
#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 @@ UNTARGET_REGION
|
||||
return check_utf8_errors<T>(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 @@ really_inline void find_whitespace_and_structurals<Architecture::WESTMERE>(
|
||||
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 @@ really_inline void find_whitespace_and_structurals<Architecture::HASWELL>(
|
||||
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 @@ really_inline void find_whitespace_and_structurals<Architecture::ARM64>(
|
||||
} // 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 @@ WARN_UNUSED ALLOW_SAME_PAGE_BUFFER_OVERRUN_QUALIFIER LENIENT_MEM_SANITIZER
|
||||
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 @@ WARN_UNUSED ALLOW_SAME_PAGE_BUFFER_OVERRUN_QUALIFIER LENIENT_MEM_SANITIZER
|
||||
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 @@ WARN_UNUSED ALLOW_SAME_PAGE_BUFFER_OVERRUN_QUALIFIER LENIENT_MEM_SANITIZER
|
||||
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 @@ int unified_machine(const char *buf, size_t len, ParsedJson &pj) {
|
||||
#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<Architecture::HASWELL> or
|
||||
@@ -39488,7 +39471,7 @@ int json_parse_implementation(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
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 @@ int json_parse_implementation(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
// 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 @@ inline int json_parse(const uint8_t *buf, size_t len, ParsedJson &pj,
|
||||
// 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<const uint8_t *>(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;
|
||||
|
||||
@@ -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<const uint8_t *>(buf), len, pj,
|
||||
realloc_if_needed);
|
||||
}
|
||||
|
||||
Architecture find_best_supported_implementation() {
|
||||
constexpr uint32_t haswell_flags =
|
||||
instruction_set::AVX2 | instruction_set::PCLMULQDQ |
|
||||
|
||||
@@ -322,4 +322,5 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
#sys.exit(main())
|
||||
main() # we don't want a hard failure on a style check.
|
||||
|
||||
+11
-1
@@ -12,4 +12,14 @@ add_cpp_test(pointercheck)
|
||||
# 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)
|
||||
# add_test(singleheader singleheader)
|
||||
|
||||
if(MSVC)
|
||||
add_custom_command(TARGET basictests POST_BUILD # Adds a post-build event
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:simdjson>"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "$<TARGET_FILE_DIR:basictests>"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different # which executes "cmake -E copy_if_different..."
|
||||
"$<TARGET_FILE:simdjson>" # <--this is in-file
|
||||
"$<TARGET_FILE_DIR:basictests>") # <--this is out-file path
|
||||
endif()
|
||||
|
||||
|
||||
+3
-3
@@ -89,9 +89,9 @@ with open(versionfile, 'w') as file:
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user