Add simdjson.cpp for unified use (#515)
This commit is contained in:
parent
99667f7c55
commit
b3ea8c406e
42
.drone.yml
42
.drone.yml
|
@ -99,6 +99,48 @@ steps:
|
|||
commands: [ make slowtests ]
|
||||
---
|
||||
kind: pipeline
|
||||
name: x64-amalgamated-build
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: gcc:8
|
||||
environment:
|
||||
SIMDJSON_TEST_AMALGAMATED_HEADERS: 1
|
||||
commands: [ make, make amalgamate ]
|
||||
---
|
||||
kind: pipeline
|
||||
name: x64-amalgamated-quicktests
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: quicktests
|
||||
image: gcc:8
|
||||
environment:
|
||||
SIMDJSON_TEST_AMALGAMATED_HEADERS: 1
|
||||
commands: [ make quicktests ]
|
||||
---
|
||||
kind: pipeline
|
||||
name: x64-amalgamated-slowtests
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: slowtests
|
||||
image: gcc:8
|
||||
environment:
|
||||
SIMDJSON_TEST_AMALGAMATED_HEADERS: 1
|
||||
commands: [ make slowtests ]
|
||||
---
|
||||
kind: pipeline
|
||||
name: stylecheck
|
||||
|
||||
platform:
|
||||
|
|
118
Makefile
118
Makefile
|
@ -22,10 +22,9 @@ else
|
|||
ARCHFLAGS ?= -msse4.2 -mpclmul # lowest supported feature set?
|
||||
endif
|
||||
|
||||
CXXFLAGS = $(ARCHFLAGS) -std=c++17 -pthread -Wall -Wextra -Wshadow -Iinclude -Isrc -Ibenchmark/linux $(EXTRAFLAGS)
|
||||
CXXFLAGS = $(ARCHFLAGS) -std=c++17 -pthread -Wall -Wextra -Wshadow -Ibenchmark/linux
|
||||
CFLAGS = $(ARCHFLAGS) -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src $(EXTRAFLAGS)
|
||||
|
||||
|
||||
# This is a convenience flag
|
||||
ifdef SANITIZEGOLD
|
||||
SANITIZE = 1
|
||||
|
@ -58,24 +57,28 @@ endif # ifeq ($(DEBUG),1)
|
|||
endif # ifeq ($(SANITIZE),1)
|
||||
endif # ifeq ($(MEMSANITIZE),1)
|
||||
|
||||
MAINEXECUTABLES=parse minify json2json jsonstats statisticalmodel jsonpointer get_corpus_benchmark
|
||||
TESTEXECUTABLES=jsoncheck jsoncheck_noavx integer_tests numberparsingcheck stringparsingcheck pointercheck jsonstream_test basictests
|
||||
COMPARISONEXECUTABLES=minifiercompetition parsingcompetition parseandstatcompetition distinctuseridcompetition allparserscheckfile allparsingcompetition
|
||||
SUPPLEMENTARYEXECUTABLES=parse_noutf8validation parse_nonumberparsing parse_nostringparsing
|
||||
# Headers and sources
|
||||
SRCHEADERS_GENERIC=src/generic/numberparsing.h src/generic/stage1_find_marks.h src/generic/stage2_build_tape.h src/generic/stringparsing.h src/generic/stage2_streaming_build_tape.h src/generic/utf8_fastvalidate_algorithm.h src/generic/utf8_lookup_algorithm.h src/generic/utf8_lookup2_algorithm.h src/generic/utf8_range_algorithm.h src/generic/utf8_zwegner_algorithm.h
|
||||
SRCHEADERS_ARM64= src/arm64/bitmanipulation.h src/arm64/bitmask.h src/arm64/intrinsics.h src/arm64/numberparsing.h src/arm64/simd.h src/arm64/stage1_find_marks.h src/arm64/stage2_build_tape.h src/arm64/stringparsing.h
|
||||
SRCHEADERS_HASWELL= src/haswell/bitmanipulation.h src/haswell/bitmask.h src/haswell/intrinsics.h src/haswell/numberparsing.h src/haswell/simd.h src/haswell/stage1_find_marks.h src/haswell/stage2_build_tape.h src/haswell/stringparsing.h
|
||||
SRCHEADERS_WESTMERE=src/westmere/bitmanipulation.h src/westmere/bitmask.h src/westmere/intrinsics.h src/westmere/numberparsing.h src/westmere/simd.h src/westmere/stage1_find_marks.h src/westmere/stage2_build_tape.h src/westmere/stringparsing.h
|
||||
SRCHEADERS_SRC=src/jsoncharutils.h src/simdprune_tables.h src/document.cpp src/error.cpp src/jsonioutil.cpp src/implementation.cpp src/stage1_find_marks.cpp src/stage2_build_tape.cpp
|
||||
SRCHEADERS=$(SRCHEADERS_SRC) $(SRCHEADERS_GENERIC) $(SRCHEADERS_ARM64) $(SRCHEADERS_HASWELL) $(SRCHEADERS_WESTMERE)
|
||||
|
||||
# Load headers and sources
|
||||
LIBHEADERS_GENERIC=src/generic/numberparsing.h src/generic/stage1_find_marks.h src/generic/stage2_build_tape.h src/generic/stringparsing.h src/generic/stage2_streaming_build_tape.h src/generic/utf8_fastvalidate_algorithm.h src/generic/utf8_lookup_algorithm.h src/generic/utf8_lookup2_algorithm.h src/generic/utf8_range_algorithm.h src/generic/utf8_zwegner_algorithm.h
|
||||
LIBHEADERS_ARM64= src/arm64/bitmanipulation.h src/arm64/bitmask.h src/arm64/intrinsics.h src/arm64/numberparsing.h src/arm64/simd.h src/arm64/stage1_find_marks.h src/arm64/stage2_build_tape.h src/arm64/stringparsing.h
|
||||
LIBHEADERS_HASWELL= src/haswell/bitmanipulation.h src/haswell/bitmask.h src/haswell/intrinsics.h src/haswell/numberparsing.h src/haswell/simd.h src/haswell/stage1_find_marks.h src/haswell/stage2_build_tape.h src/haswell/stringparsing.h
|
||||
LIBHEADERS_WESTMERE=src/westmere/bitmanipulation.h src/westmere/bitmask.h src/westmere/intrinsics.h src/westmere/numberparsing.h src/westmere/simd.h src/westmere/stage1_find_marks.h src/westmere/stage2_build_tape.h src/westmere/stringparsing.h
|
||||
LIBHEADERS=src/jsoncharutils.h src/simdprune_tables.h $(LIBHEADERS_GENERIC) $(LIBHEADERS_ARM64) $(LIBHEADERS_HASWELL) $(LIBHEADERS_WESTMERE)
|
||||
INCLUDEHEADERS=include/simdjson.h include/simdjson/common_defs.h include/simdjson/isadetection.h include/simdjson/jsonformatutils.h include/simdjson/jsonioutil.h include/simdjson/jsonminifier.h include/simdjson/jsonparser.h include/simdjson/padded_string.h include/simdjson/document.h include/simdjson/inline/document.h include/simdjson/document_iterator.h include/simdjson/inline/document_iterator.h include/simdjson/implementation.h include/simdjson/parsedjson.h include/simdjson/jsonstream.h include/simdjson/portability.h include/simdjson/error.h include/simdjson/simdjson.h include/simdjson/simdjson_version.h
|
||||
|
||||
PUBHEADERS=include/simdjson/common_defs.h include/simdjson/isadetection.h include/simdjson/jsonformatutils.h include/simdjson/jsonioutil.h include/simdjson/jsonminifier.h include/simdjson/jsonparser.h include/simdjson/padded_string.h include/simdjson/document.h include/simdjson/inline/document.h include/simdjson/document_iterator.h include/simdjson/inline/document_iterator.h include/simdjson/implementation.h include/simdjson/parsedjson.h include/simdjson/jsonstream.h include/simdjson/portability.h include/simdjson/error.h include/simdjson/simdjson.h include/simdjson/simdjson_version.h
|
||||
HEADERS=$(PUBHEADERS) $(LIBHEADERS)
|
||||
ifeq ($(SIMDJSON_TEST_AMALGAMATED_HEADERS),1)
|
||||
HEADERS=singleheader/simdjson.h
|
||||
LIBFILES=singleheader/simdjson.cpp
|
||||
CXXFLAGS += -Isingleheader
|
||||
else
|
||||
HEADERS=$(INCLUDEHEADERS) $(SRCHEADERS)
|
||||
LIBFILES=src/simdjson.cpp
|
||||
CXXFLAGS += -Isrc -Iinclude
|
||||
endif
|
||||
|
||||
LIBFILES=src/document.cpp src/error.cpp src/jsonioutil.cpp src/implementation.cpp src/stage1_find_marks.cpp src/stage2_build_tape.cpp
|
||||
MINIFIERHEADERS=include/simdjson/jsonminifier.h
|
||||
MINIFIERLIBFILES=src/jsonminifier.cpp
|
||||
# We put EXTRAFLAGS after all other CXXFLAGS so they can override if necessary
|
||||
CXXFLAGS += $(EXTRAFLAGS)
|
||||
|
||||
FEATURE_JSON_FILES=jsonexamples/generated/0-structurals-full.json jsonexamples/generated/0-structurals-miss.json jsonexamples/generated/0-structurals.json jsonexamples/generated/15-structurals-full.json jsonexamples/generated/15-structurals-miss.json jsonexamples/generated/15-structurals.json jsonexamples/generated/23-structurals-full.json jsonexamples/generated/23-structurals-miss.json jsonexamples/generated/23-structurals.json jsonexamples/generated/7-structurals-full.json jsonexamples/generated/7-structurals-miss.json jsonexamples/generated/7-structurals.json jsonexamples/generated/escape-full.json jsonexamples/generated/escape-miss.json jsonexamples/generated/escape.json jsonexamples/generated/utf-8-full.json jsonexamples/generated/utf-8-miss.json jsonexamples/generated/utf-8.json
|
||||
|
||||
|
@ -89,9 +92,13 @@ CJSON_INCLUDE:=dependencies/cJSON/cJSON.h
|
|||
JSMN_INCLUDE:=dependencies/jsmn/jsmn.h
|
||||
JSON_INCLUDE:=dependencies/json/single_include/nlohmann/json.hpp
|
||||
|
||||
LIBS=$(RAPIDJSON_INCLUDE) $(JSON_INCLUDE) $(SAJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE) $(CJSON_INCLUDE) $(JSMN_INCLUDE)
|
||||
|
||||
EXTRAOBJECTS=ujdecode.o
|
||||
|
||||
MAINEXECUTABLES=parse minify json2json jsonstats statisticalmodel jsonpointer get_corpus_benchmark
|
||||
TESTEXECUTABLES=jsoncheck jsoncheck_noavx integer_tests numberparsingcheck stringparsingcheck pointercheck jsonstream_test basictests readme_examples
|
||||
COMPARISONEXECUTABLES=minifiercompetition parsingcompetition parseandstatcompetition distinctuseridcompetition allparserscheckfile allparsingcompetition
|
||||
SUPPLEMENTARYEXECUTABLES=parse_noutf8validation parse_nonumberparsing parse_nostringparsing
|
||||
|
||||
all: $(MAINEXECUTABLES)
|
||||
|
||||
competition: $(COMPARISONEXECUTABLES)
|
||||
|
@ -152,7 +159,12 @@ slowtests: run_testjson2json_sh run_issue150_sh
|
|||
|
||||
amalgamate:
|
||||
./amalgamation.sh
|
||||
$(CXX) $(CXXFLAGS) -o singleheader/demo ./singleheader/amalgamation_demo.cpp -Isingleheader
|
||||
|
||||
singleheader/simdjson.h singleheader/simdjson.cpp singleheader/amalgamation_demo.cpp: amalgamation.sh src/simdjson.cpp $(SRCHEADERS) $(INCLUDEHEADERS)
|
||||
./amalgamation.sh
|
||||
|
||||
singleheader/demo: singleheader/simdjson.h singleheader/simdjson.cpp singleheader/amalgamation_demo.cpp
|
||||
$(CXX) $(CXXFLAGS) -o singleheader/demo singleheader/amalgamation_demo.cpp -Isingleheader
|
||||
|
||||
submodules:
|
||||
-git submodule update --init --recursive
|
||||
|
@ -161,102 +173,102 @@ submodules:
|
|||
$(JSON_INCLUDE) $(SAJSON_INCLUDE) $(RAPIDJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE) $(CJSON_INCLUDE) $(JSMN_INCLUDE) : submodules
|
||||
|
||||
parse: benchmark/parse.cpp benchmark/event_counter.h benchmark/benchmarker.h $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parse $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o parse benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
get_corpus_benchmark: benchmark/get_corpus_benchmark.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o get_corpus_benchmark $(LIBFILES) benchmark/get_corpus_benchmark.cpp $(LIBFLAGS)
|
||||
get_corpus_benchmark: benchmark/get_corpus_benchmark.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o get_corpus_benchmark benchmark/get_corpus_benchmark.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
parse_stream: benchmark/parse_stream.cpp benchmark/event_counter.h benchmark/benchmarker.h $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parse_stream $(LIBFILES) benchmark/parse_stream.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o parse_stream benchmark/parse_stream.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
benchfeatures: benchmark/benchfeatures.cpp benchmark/event_counter.h benchmark/benchmarker.h $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o benchfeatures $(LIBFILES) benchmark/benchfeatures.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o benchfeatures benchmark/benchfeatures.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
perfdiff: benchmark/perfdiff.cpp
|
||||
$(CXX) $(CXXFLAGS) -o perfdiff benchmark/perfdiff.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o perfdiff benchmark/perfdiff.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
checkperf:
|
||||
bash ./scripts/checkperf.sh $(REFERENCE_VERSION)
|
||||
|
||||
statisticalmodel: benchmark/statisticalmodel.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o statisticalmodel $(LIBFILES) benchmark/statisticalmodel.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o statisticalmodel benchmark/statisticalmodel.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
|
||||
parse_noutf8validation: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parse_noutf8validation -DSIMDJSON_SKIPUTF8VALIDATION $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o parse_noutf8validation -DSIMDJSON_SKIPUTF8VALIDATION benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
parse_nonumberparsing: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parse_nonumberparsing -DSIMDJSON_SKIPNUMBERPARSING $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o parse_nonumberparsing -DSIMDJSON_SKIPNUMBERPARSING benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
parse_nostringparsing: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parse_nostringparsing -DSIMDJSON_SKIPSTRINGPARSING $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o parse_nostringparsing -DSIMDJSON_SKIPSTRINGPARSING benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
|
||||
jsoncheck:tests/jsoncheck.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o jsoncheck $(LIBFILES) tests/jsoncheck.cpp -I. $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o jsoncheck tests/jsoncheck.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
jsonstream_test:tests/jsonstream_test.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o jsonstream_test $(LIBFILES) tests/jsonstream_test.cpp -I. $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o jsonstream_test tests/jsonstream_test.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
|
||||
jsoncheck_noavx:tests/jsoncheck.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o jsoncheck_noavx $(LIBFILES) tests/jsoncheck.cpp -I. $(LIBFLAGS) -DSIMDJSON_DISABLE_AVX2_DETECTION
|
||||
$(CXX) $(CXXFLAGS) -o jsoncheck_noavx tests/jsoncheck.cpp -I. $(LIBFILES) $(LIBFLAGS) -DSIMDJSON_DISABLE_AVX2_DETECTION
|
||||
|
||||
basictests:tests/basictests.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o basictests $(LIBFILES) tests/basictests.cpp -I. $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o basictests tests/basictests.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
readme_examples: tests/readme_examples.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o readme_examples $(LIBFILES) tests/readme_examples.cpp -I. $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o readme_examples tests/readme_examples.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
|
||||
numberparsingcheck:tests/numberparsingcheck.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o numberparsingcheck src/jsonioutil.cpp src/implementation.cpp src/error.cpp src/stage1_find_marks.cpp src/document.cpp tests/numberparsingcheck.cpp -I. $(LIBFLAGS) -DJSON_TEST_NUMBERS
|
||||
numberparsingcheck: tests/numberparsingcheck.cpp $(HEADERS) src/simdjson.cpp
|
||||
$(CXX) $(CXXFLAGS) -o numberparsingcheck tests/numberparsingcheck.cpp -I. $(LIBFLAGS) -DJSON_TEST_NUMBERS
|
||||
|
||||
integer_tests:tests/integer_tests.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o integer_tests $(LIBFILES) tests/integer_tests.cpp -I. $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o integer_tests tests/integer_tests.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
|
||||
|
||||
stringparsingcheck:tests/stringparsingcheck.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o stringparsingcheck src/jsonioutil.cpp src/implementation.cpp src/error.cpp src/stage1_find_marks.cpp src/document.cpp tests/stringparsingcheck.cpp -I. $(LIBFLAGS) -DJSON_TEST_STRINGS
|
||||
stringparsingcheck: tests/stringparsingcheck.cpp $(HEADERS) src/simdjson.cpp
|
||||
$(CXX) $(CXXFLAGS) -o stringparsingcheck tests/stringparsingcheck.cpp -I. $(LIBFLAGS) -DJSON_TEST_STRINGS
|
||||
|
||||
pointercheck:tests/pointercheck.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o pointercheck $(LIBFILES) tests/pointercheck.cpp -I. $(LIBFLAGS)
|
||||
$(CXX) $(CXXFLAGS) -o pointercheck tests/pointercheck.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
minifiercompetition: benchmark/minifiercompetition.cpp $(HEADERS) submodules $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o minifiercompetition $(LIBFILES) $(MINIFIERLIBFILES) benchmark/minifiercompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE)
|
||||
minifiercompetition: benchmark/minifiercompetition.cpp submodules $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o minifiercompetition benchmark/minifiercompetition.cpp -I. $(LIBFILES) $(LIBFLAGS) $(COREDEPSINCLUDE)
|
||||
|
||||
minify: tools/minify.cpp $(HEADERS) $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o minify $(MINIFIERLIBFILES) $(LIBFILES) tools/minify.cpp -I.
|
||||
minify: tools/minify.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o minify tools/minify.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
json2json: tools/json2json.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o json2json $ tools/json2json.cpp $(LIBFILES) -I.
|
||||
$(CXX) $(CXXFLAGS) -o json2json $ tools/json2json.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
jsonpointer: tools/jsonpointer.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o jsonpointer $ tools/jsonpointer.cpp $(LIBFILES) -I.
|
||||
$(CXX) $(CXXFLAGS) -o jsonpointer $ tools/jsonpointer.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
jsonstats: tools/jsonstats.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o jsonstats $ tools/jsonstats.cpp $(LIBFILES) -I.
|
||||
$(CXX) $(CXXFLAGS) -o jsonstats $ tools/jsonstats.cpp -I. $(LIBFILES) $(LIBFLAGS)
|
||||
|
||||
ujdecode.o: $(UJSON4C_INCLUDE)
|
||||
$(CC) $(CFLAGS) -c dependencies/ujson4c/src/ujdecode.c
|
||||
|
||||
parseandstatcompetition: benchmark/parseandstatcompetition.cpp $(HEADERS) $(LIBFILES) submodules
|
||||
$(CXX) $(CXXFLAGS) -o parseandstatcompetition $(LIBFILES) benchmark/parseandstatcompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE)
|
||||
$(CXX) $(CXXFLAGS) -o parseandstatcompetition benchmark/parseandstatcompetition.cpp -I. $(LIBFILES) $(LIBFLAGS) $(COREDEPSINCLUDE)
|
||||
|
||||
distinctuseridcompetition: benchmark/distinctuseridcompetition.cpp $(HEADERS) $(LIBFILES) submodules
|
||||
$(CXX) $(CXXFLAGS) -o distinctuseridcompetition $(LIBFILES) benchmark/distinctuseridcompetition.cpp -I. $(LIBFLAGS) $(COREDEPSINCLUDE)
|
||||
$(CXX) $(CXXFLAGS) -o distinctuseridcompetition benchmark/distinctuseridcompetition.cpp -I. $(LIBFILES) $(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)
|
||||
$(CXX) $(CXXFLAGS) -o parsingcompetition benchmark/parsingcompetition.cpp -I. $(LIBFILES) $(LIBFLAGS) $(COREDEPSINCLUDE)
|
||||
|
||||
allparsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES) $(EXTRAOBJECTS) submodules
|
||||
$(CXX) $(CXXFLAGS) -o allparsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp $(EXTRAOBJECTS) -I. $(LIBFLAGS) $(COREDEPSINCLUDE) $(EXTRADEPSINCLUDE) -DALLPARSER
|
||||
$(CXX) $(CXXFLAGS) -o allparsingcompetition benchmark/parsingcompetition.cpp $(EXTRAOBJECTS) -I. $(LIBFILES) $(LIBFLAGS) $(COREDEPSINCLUDE) $(EXTRADEPSINCLUDE) -DALLPARSER
|
||||
|
||||
|
||||
allparserscheckfile: tests/allparserscheckfile.cpp $(HEADERS) $(LIBFILES) $(EXTRAOBJECTS) submodules
|
||||
$(CXX) $(CXXFLAGS) -o allparserscheckfile $(LIBFILES) tests/allparserscheckfile.cpp $(EXTRAOBJECTS) -I. $(LIBFLAGS) $(COREDEPSINCLUDE) $(EXTRADEPSINCLUDE)
|
||||
$(CXX) $(CXXFLAGS) -o allparserscheckfile tests/allparserscheckfile.cpp $(EXTRAOBJECTS) -I. $(LIBFILES) $(LIBFLAGS) $(COREDEPSINCLUDE) $(EXTRADEPSINCLUDE)
|
||||
|
||||
.PHONY: clean cppcheck cleandist
|
||||
|
||||
|
|
|
@ -16,13 +16,7 @@ INCLUDEPATH="$SCRIPTPATH/include"
|
|||
|
||||
# this list excludes the "src/generic headers"
|
||||
ALLCFILES="
|
||||
document.cpp
|
||||
error.cpp
|
||||
implementation.cpp
|
||||
jsonioutil.cpp
|
||||
jsonminifier.cpp
|
||||
stage1_find_marks.cpp
|
||||
stage2_build_tape.cpp
|
||||
simdjson.cpp
|
||||
"
|
||||
|
||||
# order matters
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#ifdef __linux__
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
//#define DEBUG
|
||||
#include "simdjson.h"
|
||||
|
||||
#include <functional>
|
||||
|
|
|
@ -184,6 +184,7 @@ Here is a simple example, using single header simdjson:
|
|||
```cpp
|
||||
#include "simdjson.h"
|
||||
#include "simdjson.cpp"
|
||||
#include "simdjson.cpp"
|
||||
|
||||
int parse_file(const char *filename) {
|
||||
simdjson::padded_string p = simdjson::get_corpus(filename);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "simdjson.h"
|
||||
#include "simdjson.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
set(SIMDJSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
|
||||
set(SIMDJSON_INCLUDE
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/compiler_check.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/common_defs.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/document.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/document.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/document_iterator.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/document_iterator.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/implementation.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/document.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/inline/document_iterator.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/isadetection.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/jsonformatutils.h
|
||||
${SIMDJSON_INCLUDE_DIR}/simdjson/jsonioutil.h
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* auto-generated on Mon Mar 2 14:10:52 PST 2020. Do not edit! */
|
||||
/* auto-generated on Mon Mar 2 15:35:47 PST 2020. Do not edit! */
|
||||
|
||||
#include <iostream>
|
||||
#include "simdjson.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* auto-generated on Mon Mar 2 14:10:52 PST 2020. Do not edit! */
|
||||
/* auto-generated on Mon Mar 2 15:35:47 PST 2020. Do not edit! */
|
||||
#include "simdjson.h"
|
||||
|
||||
/* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */
|
||||
|
@ -6,6 +6,7 @@
|
|||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
/* begin file src/simdjson.cpp */
|
||||
/* begin file src/document.cpp */
|
||||
|
||||
namespace simdjson {
|
||||
|
@ -31,8 +32,7 @@ bool document::set_capacity(size_t capacity) {
|
|||
return string_buf && tape;
|
||||
}
|
||||
|
||||
WARN_UNUSED
|
||||
bool document::print_json(std::ostream &os, size_t max_depth) const {
|
||||
bool document::print_json(std::ostream &os, size_t max_depth) const noexcept {
|
||||
uint32_t string_length;
|
||||
size_t tape_idx = 0;
|
||||
uint64_t tape_val = tape[tape_idx];
|
||||
|
@ -138,8 +138,7 @@ bool document::print_json(std::ostream &os, size_t max_depth) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
WARN_UNUSED
|
||||
bool document::dump_raw_tape(std::ostream &os) const {
|
||||
bool document::dump_raw_tape(std::ostream &os) const noexcept {
|
||||
uint32_t string_length;
|
||||
size_t tape_idx = 0;
|
||||
uint64_t tape_val = tape[tape_idx];
|
||||
|
@ -325,6 +324,9 @@ const std::map<int, const std::string> error_strings = {
|
|||
{UNSUPPORTED_ARCHITECTURE, "simdjson does not have an implementation"
|
||||
" supported by this CPU architecture (perhaps"
|
||||
" it's a non-SIMD CPU?)."},
|
||||
{INCORRECT_TYPE, "The JSON element does not have the requested type."},
|
||||
{NUMBER_OUT_OF_RANGE, "The JSON number is too large or too small to fit within the requested type."},
|
||||
{NO_SUCH_FIELD, "The JSON field referenced does not exist in this object."},
|
||||
{UNEXPECTED_ERROR, "Unexpected error, consider reporting this problem as"
|
||||
" you may have found a bug in simdjson"},
|
||||
};
|
||||
|
@ -2330,7 +2332,7 @@ really_inline uint64_t follows(const uint64_t match, uint64_t &overflow) {
|
|||
really_inline uint64_t follows(const uint64_t match, const uint64_t filler, uint64_t &overflow) {
|
||||
uint64_t follows_match = follows(match, overflow);
|
||||
uint64_t result;
|
||||
overflow |= add_overflow(follows_match, filler, &result);
|
||||
overflow |= uint64_t(add_overflow(follows_match, filler, &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2639,7 +2641,6 @@ namespace simdjson::haswell::simd {
|
|||
really_inline Child operator&(const Child other) const { return _mm256_and_si256(*this, other); }
|
||||
really_inline Child operator^(const Child other) const { return _mm256_xor_si256(*this, other); }
|
||||
really_inline Child bit_andnot(const Child other) const { return _mm256_andnot_si256(other, *this); }
|
||||
really_inline Child operator~() const { return *this ^ 0xFFu; }
|
||||
really_inline Child& operator|=(const Child other) { auto this_cast = (Child*)this; *this_cast = *this_cast | other; return *this_cast; }
|
||||
really_inline Child& operator&=(const Child other) { auto this_cast = (Child*)this; *this_cast = *this_cast & other; return *this_cast; }
|
||||
really_inline Child& operator^=(const Child other) { auto this_cast = (Child*)this; *this_cast = *this_cast ^ other; return *this_cast; }
|
||||
|
@ -2679,6 +2680,7 @@ namespace simdjson::haswell::simd {
|
|||
|
||||
really_inline int to_bitmask() const { return _mm256_movemask_epi8(*this); }
|
||||
really_inline bool any() const { return !_mm256_testz_si256(*this, *this); }
|
||||
really_inline simd8<bool> operator~() const { return *this ^ true; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -2713,6 +2715,9 @@ namespace simdjson::haswell::simd {
|
|||
really_inline simd8<T>& operator+=(const simd8<T> other) { *this = *this + other; return *(simd8<T>*)this; }
|
||||
really_inline simd8<T>& operator-=(const simd8<T> other) { *this = *this - other; return *(simd8<T>*)this; }
|
||||
|
||||
// Override to distinguish from bool version
|
||||
really_inline simd8<T> operator~() const { return *this ^ 0xFFu; }
|
||||
|
||||
// Perform a lookup assuming the value is between 0 and 16 (undefined behavior for out of range values)
|
||||
template<typename L>
|
||||
really_inline simd8<L> lookup_16(simd8<L> lookup_table) const {
|
||||
|
@ -3675,7 +3680,7 @@ really_inline uint64_t follows(const uint64_t match, uint64_t &overflow) {
|
|||
really_inline uint64_t follows(const uint64_t match, const uint64_t filler, uint64_t &overflow) {
|
||||
uint64_t follows_match = follows(match, overflow);
|
||||
uint64_t result;
|
||||
overflow |= add_overflow(follows_match, filler, &result);
|
||||
overflow |= uint64_t(add_overflow(follows_match, filler, &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3982,7 +3987,6 @@ namespace simdjson::westmere::simd {
|
|||
really_inline Child operator&(const Child other) const { return _mm_and_si128(*this, other); }
|
||||
really_inline Child operator^(const Child other) const { return _mm_xor_si128(*this, other); }
|
||||
really_inline Child bit_andnot(const Child other) const { return _mm_andnot_si128(other, *this); }
|
||||
really_inline Child operator~() const { return *this ^ 0xFFu; }
|
||||
really_inline Child& operator|=(const Child other) { auto this_cast = (Child*)this; *this_cast = *this_cast | other; return *this_cast; }
|
||||
really_inline Child& operator&=(const Child other) { auto this_cast = (Child*)this; *this_cast = *this_cast & other; return *this_cast; }
|
||||
really_inline Child& operator^=(const Child other) { auto this_cast = (Child*)this; *this_cast = *this_cast ^ other; return *this_cast; }
|
||||
|
@ -4022,6 +4026,7 @@ namespace simdjson::westmere::simd {
|
|||
|
||||
really_inline int to_bitmask() const { return _mm_movemask_epi8(*this); }
|
||||
really_inline bool any() const { return !_mm_testz_si128(*this, *this); }
|
||||
really_inline simd8<bool> operator~() const { return *this ^ true; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
@ -4048,6 +4053,9 @@ namespace simdjson::westmere::simd {
|
|||
// Store to array
|
||||
really_inline void store(T dst[16]) const { return _mm_storeu_si128(reinterpret_cast<__m128i *>(dst), *this); }
|
||||
|
||||
// Override to distinguish from bool version
|
||||
really_inline simd8<T> operator~() const { return *this ^ 0xFFu; }
|
||||
|
||||
// Addition/subtraction are the same for signed and unsigned
|
||||
really_inline simd8<T> operator+(const simd8<T> other) const { return _mm_add_epi8(*this, other); }
|
||||
really_inline simd8<T> operator-(const simd8<T> other) const { return _mm_sub_epi8(*this, other); }
|
||||
|
@ -5032,7 +5040,7 @@ really_inline uint64_t follows(const uint64_t match, uint64_t &overflow) {
|
|||
really_inline uint64_t follows(const uint64_t match, const uint64_t filler, uint64_t &overflow) {
|
||||
uint64_t follows_match = follows(match, overflow);
|
||||
uint64_t result;
|
||||
overflow |= add_overflow(follows_match, filler, &result);
|
||||
overflow |= uint64_t(add_overflow(follows_match, filler, &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -5914,9 +5922,9 @@ never_inline bool parse_large_integer(const uint8_t *const buf,
|
|||
// content and append a space before calling this function.
|
||||
//
|
||||
// Our objective is accurate parsing (ULP of 0 or 1) at high speed.
|
||||
really_inline bool parse_number(const uint8_t *const buf,
|
||||
const uint32_t offset,
|
||||
bool found_minus,
|
||||
really_inline bool parse_number(UNUSED const uint8_t *const buf,
|
||||
UNUSED const uint32_t offset,
|
||||
UNUSED bool found_minus,
|
||||
document::parser &parser) {
|
||||
#ifdef SIMDJSON_SKIPNUMBERPARSING // for performance analysis, it is sometimes
|
||||
// useful to skip parsing
|
||||
|
@ -7281,9 +7289,9 @@ never_inline bool parse_large_integer(const uint8_t *const buf,
|
|||
// content and append a space before calling this function.
|
||||
//
|
||||
// Our objective is accurate parsing (ULP of 0 or 1) at high speed.
|
||||
really_inline bool parse_number(const uint8_t *const buf,
|
||||
const uint32_t offset,
|
||||
bool found_minus,
|
||||
really_inline bool parse_number(UNUSED const uint8_t *const buf,
|
||||
UNUSED const uint32_t offset,
|
||||
UNUSED bool found_minus,
|
||||
document::parser &parser) {
|
||||
#ifdef SIMDJSON_SKIPNUMBERPARSING // for performance analysis, it is sometimes
|
||||
// useful to skip parsing
|
||||
|
@ -8658,9 +8666,9 @@ never_inline bool parse_large_integer(const uint8_t *const buf,
|
|||
// content and append a space before calling this function.
|
||||
//
|
||||
// Our objective is accurate parsing (ULP of 0 or 1) at high speed.
|
||||
really_inline bool parse_number(const uint8_t *const buf,
|
||||
const uint32_t offset,
|
||||
bool found_minus,
|
||||
really_inline bool parse_number(UNUSED const uint8_t *const buf,
|
||||
UNUSED const uint32_t offset,
|
||||
UNUSED bool found_minus,
|
||||
document::parser &parser) {
|
||||
#ifdef SIMDJSON_SKIPNUMBERPARSING // for performance analysis, it is sometimes
|
||||
// useful to skip parsing
|
||||
|
@ -9429,3 +9437,4 @@ UNTARGET_REGION
|
|||
#endif // SIMDJSON_WESTMERE_STAGE2_BUILD_TAPE_H
|
||||
/* end file src/generic/stage2_streaming_build_tape.h */
|
||||
/* end file src/generic/stage2_streaming_build_tape.h */
|
||||
/* end file src/generic/stage2_streaming_build_tape.h */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -22,6 +22,11 @@ include(../include/CMakeLists.txt)
|
|||
set(SIMDJSON_SRC_DIR $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
||||
|
||||
set(SIMDJSON_SRC
|
||||
simdjson.cpp
|
||||
)
|
||||
|
||||
# Load headers and sources
|
||||
set(SIMDJSON_SRC_HEADERS
|
||||
jsonioutil.cpp
|
||||
jsonminifier.cpp
|
||||
stage1_find_marks.cpp
|
||||
|
@ -29,10 +34,6 @@ set(SIMDJSON_SRC
|
|||
document.cpp
|
||||
implementation.cpp
|
||||
error.cpp
|
||||
)
|
||||
|
||||
# Load headers and sources
|
||||
set(SIMDJSON_SRC_HEADERS
|
||||
jsoncharutils.h
|
||||
simdprune_tables.h
|
||||
arm64/bitmask.h
|
||||
|
@ -72,6 +73,7 @@ set(SIMDJSON_SRC_HEADERS
|
|||
westmere/stringparsing.h
|
||||
westmere/numberparsing.h
|
||||
)
|
||||
set_source_files_properties(${SIMDJSON_SRC_HEADERS} PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
add_library(${SIMDJSON_LIB_NAME} ${SIMDJSON_LIB_TYPE} ${SIMDJSON_SRC} ${SIMDJSON_INCLUDE} ${SIMDJSON_SRC_HEADERS})
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#include "document.cpp"
|
||||
#include "error.cpp"
|
||||
#include "implementation.cpp"
|
||||
#include "jsonioutil.cpp"
|
||||
#include "jsonminifier.cpp"
|
||||
#include "stage1_find_marks.cpp"
|
||||
#include "stage2_build_tape.cpp"
|
|
@ -133,7 +133,7 @@ void found_float(double result, const uint8_t *buf) {
|
|||
}
|
||||
|
||||
#include "simdjson.h"
|
||||
#include "src/stage2_build_tape.cpp"
|
||||
#include "simdjson.cpp"
|
||||
|
||||
/**
|
||||
* Does the file filename ends with the given extension.
|
||||
|
|
|
@ -9,7 +9,7 @@ void document_parse_error_code() {
|
|||
string json("[ 1, 2, 3 ]");
|
||||
auto [doc, error] = document::parse(json);
|
||||
if (error) { cerr << "Error: " << error_message(error) << endl; exit(1); }
|
||||
UNUSED doc.print_json(cout);
|
||||
if (!doc.print_json(cout)) { exit(1); }
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ void document_parse_exception() {
|
|||
|
||||
string json("[ 1, 2, 3 ]");
|
||||
document doc = document::parse(json);
|
||||
UNUSED doc.print_json(cout);
|
||||
if (!doc.print_json(cout)) { exit(1); }
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ void document_parse_padded_string() {
|
|||
|
||||
padded_string json(string("[ 1, 2, 3 ]"));
|
||||
document doc = document::parse(json);
|
||||
UNUSED doc.print_json(cout);
|
||||
if (!doc.print_json(cout)) { exit(1); }
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ void document_parse_get_corpus() {
|
|||
|
||||
padded_string json(get_corpus("jsonexamples/small/demo.json"));
|
||||
document doc = document::parse(json);
|
||||
UNUSED doc.print_json(cout);
|
||||
if (!doc.print_json(cout)) { exit(1); }
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ void parser_parse() {
|
|||
cout << "Parsing " << json.data() << " ..." << endl;
|
||||
auto [doc, error] = parser.parse(json);
|
||||
if (error) { cerr << "Error: " << error_message(error) << endl; exit(1); }
|
||||
UNUSED doc.print_json(cout);
|
||||
if (!doc.print_json(cout)) { exit(1); }
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -290,7 +290,7 @@ void found_string(const uint8_t *buf, const uint8_t *parsed_begin,
|
|||
}
|
||||
|
||||
#include "simdjson.h"
|
||||
#include "src/stage2_build_tape.cpp"
|
||||
#include "simdjson.cpp"
|
||||
|
||||
/**
|
||||
* Does the file filename ends with the given extension.
|
||||
|
|
Loading…
Reference in New Issue