2018-03-23 12:05:32 +08:00
|
|
|
|
|
|
|
.SUFFIXES:
|
|
|
|
#
|
|
|
|
.SUFFIXES: .cpp .o .c .h
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: clean cleandist
|
|
|
|
|
2018-08-25 01:20:20 +08:00
|
|
|
CXXFLAGS = -std=c++11 -g2 -O2 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux -Idependencies/double-conversion -Idependencies/rapidjson/include -Ldependencies/double-conversion/release
|
2018-07-29 09:17:54 +08:00
|
|
|
LIBFLAGS = -ldouble-conversion
|
2018-09-26 05:20:54 +08:00
|
|
|
EXECUTABLES=parse jsoncheck minifiercompetition parsingcompetition parseunified
|
2018-08-25 08:49:45 +08:00
|
|
|
DOUBLEEXECUTABLES=parsedouble jsoncheckdouble parsingcompetitiondouble
|
2018-03-23 12:05:32 +08:00
|
|
|
|
2018-09-24 08:42:30 +08:00
|
|
|
HEADERS=include/jsonparser/jsonparser.h include/jsonparser/common_defs.h include/jsonparser/jsonioutil.h benchmark/benchmark.h benchmark/linux/linux-perf-events.h include/jsonparser/simdjson_internal.h include/jsonparser/stage1_find_marks.h include/jsonparser/stage2_flatten.h include/jsonparser/stage3_ape_machine.h include/jsonparser/stage4_shovel_machine.h include/jsonparser/stage34_unified.h
|
|
|
|
LIBFILES=src/jsonioutil.cpp src/jsonparser.cpp src/stage1_find_marks.cpp src/stage2_flatten.cpp src/stage3_ape_machine.cpp src/stage4_shovel_machine.cpp src/stage34_unified.cpp
|
2018-08-21 05:51:38 +08:00
|
|
|
MINIFIERHEADERS=include/jsonparser/jsonminifier.h include/jsonparser/simdprune_tables.h
|
2018-08-21 05:40:50 +08:00
|
|
|
MINIFIERLIBFILES=src/jsonminifier.cpp
|
|
|
|
|
2018-07-29 06:28:50 +08:00
|
|
|
EXTRA_EXECUTABLES=parsenocheesy parsenodep8
|
2018-03-23 12:05:32 +08:00
|
|
|
|
2018-08-21 05:27:25 +08:00
|
|
|
LIBDOUBLE:=dependencies/double-conversion/release/libdouble-conversion.a
|
|
|
|
RAPIDJSON_INCLUDE:=dependencies/rapidjson/include
|
2018-07-29 08:18:56 +08:00
|
|
|
|
2018-08-21 05:27:25 +08:00
|
|
|
LIBS=$(RAPIDJSON_INCLUDE) $(LIBDOUBLE)
|
2018-07-29 08:18:56 +08:00
|
|
|
|
2018-08-25 08:49:45 +08:00
|
|
|
all: $(LIBS) $(EXECUTABLES) $(DOUBLEEXECUTABLES)
|
2018-08-18 07:57:31 +08:00
|
|
|
|
|
|
|
test: jsoncheck
|
|
|
|
./jsoncheck
|
2018-03-23 12:05:32 +08:00
|
|
|
|
2018-08-21 05:27:25 +08:00
|
|
|
$(RAPIDJSON_INCLUDE):
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
|
|
|
$(LIBDOUBLE) : dependencies/double-conversion/README.md
|
2018-07-29 08:18:56 +08:00
|
|
|
cd dependencies/double-conversion/ && mkdir -p release && cd release && cmake .. && make
|
|
|
|
|
2018-08-21 05:27:25 +08:00
|
|
|
|
|
|
|
bench: benchmarks/bench.cpp $(RAPIDJSON_INCLUDE) $(HEADERS)
|
|
|
|
$(CXX) -std=c++11 -O3 -o $@ benchmarks/bench.cpp -I$(RAPIDJSON_INCLUDE) -Iinclude -march=native -lm -Wall -Wextra -Wno-narrowing
|
|
|
|
|
|
|
|
|
2018-09-26 05:20:54 +08:00
|
|
|
parseunified: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parseunified $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS) -DTEST_UNIFIED
|
2018-08-21 05:27:25 +08:00
|
|
|
|
2018-08-21 02:45:51 +08:00
|
|
|
parse: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parse $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS)
|
2018-08-18 07:57:31 +08:00
|
|
|
|
|
|
|
jsoncheck:tests/jsoncheck.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o jsoncheck $(LIBFILES) tests/jsoncheck.cpp -I. $(LIBFLAGS)
|
|
|
|
|
2018-08-21 05:40:50 +08:00
|
|
|
minifiercompetition: benchmark/minifiercompetition.cpp $(HEADERS) $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o minifiercompetition $(LIBFILES) $(MINIFIERLIBFILES) benchmark/minifiercompetition.cpp -I. $(LIBFLAGS)
|
2018-08-21 05:27:25 +08:00
|
|
|
|
|
|
|
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp -I. $(LIBFLAGS)
|
|
|
|
|
2018-08-25 08:49:45 +08:00
|
|
|
parsedouble: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsedouble $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS) -DDOUBLECONV
|
|
|
|
|
|
|
|
jsoncheckdouble:tests/jsoncheck.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o jsoncheckdouble $(LIBFILES) tests/jsoncheck.cpp -I. $(LIBFLAGS) -DDOUBLECONV
|
|
|
|
|
|
|
|
parsingcompetitiondouble: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsingcompetitiondouble $(LIBFILES) benchmark/parsingcompetition.cpp -I. $(LIBFLAGS) -DDOUBLECONV
|
|
|
|
|
2018-03-23 12:05:32 +08:00
|
|
|
|
2018-08-21 02:45:51 +08:00
|
|
|
parsehisto: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsehisto benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS) -DBUILDHISTOGRAM
|
2018-07-30 01:09:47 +08:00
|
|
|
|
|
|
|
testflatten: parse parsenocheesy parsenodep8 parsenodep10 parsenodep12
|
2018-07-27 04:36:35 +08:00
|
|
|
for filename in jsonexamples/twitter.json jsonexamples/gsoc-2018.json jsonexamples/citm_catalog.json jsonexamples/canada.json ; do \
|
|
|
|
echo $$filename ; \
|
|
|
|
set -x; \
|
|
|
|
./parsenocheesy $$filename ; \
|
2018-07-29 06:28:50 +08:00
|
|
|
./parse $$filename ; \
|
2018-07-27 04:36:35 +08:00
|
|
|
./parsenodep8 $$filename ; \
|
2018-07-30 01:09:47 +08:00
|
|
|
./parsenodep10 $$filename ; \
|
|
|
|
./parsenodep12 $$filename ; \
|
2018-07-27 04:36:35 +08:00
|
|
|
set +x; \
|
|
|
|
done
|
|
|
|
|
2018-08-21 02:45:51 +08:00
|
|
|
parsenocheesy: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsenocheesy benchmark/parse.cpp $(LIBFILES) -DSUPPRESS_CHEESY_FLATTEN
|
2018-07-27 04:36:35 +08:00
|
|
|
|
2018-08-21 02:45:51 +08:00
|
|
|
parsenodep8: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsenodep8 benchmark/parse.cpp $(LIBFILES) -DNO_PDEP_PLEASE -DNO_PDEP_WIDTH=8
|
2018-07-27 04:36:35 +08:00
|
|
|
|
2018-08-21 02:45:51 +08:00
|
|
|
parsenodep10: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsenodep12 benchmark/parse.cpp $(LIBFILES) -DNO_PDEP_PLEASE -DNO_PDEP_WIDTH=10
|
2018-07-30 01:09:47 +08:00
|
|
|
|
|
|
|
|
2018-08-21 02:45:51 +08:00
|
|
|
parsenodep12: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
|
|
|
$(CXX) $(CXXFLAGS) -o parsenodep12 benchmark/parse.cpp $(LIBFILES) -DNO_PDEP_PLEASE -DNO_PDEP_WIDTH=12
|
2018-07-30 01:09:47 +08:00
|
|
|
|
|
|
|
|
2018-07-29 08:18:56 +08:00
|
|
|
dependencies/double-conversion/README.md:
|
|
|
|
git pull && git submodule init && git submodule update && git submodule status
|
2018-03-23 12:05:32 +08:00
|
|
|
|
|
|
|
clean:
|
2018-07-29 06:28:50 +08:00
|
|
|
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
2018-03-23 12:05:32 +08:00
|
|
|
|
|
|
|
cleandist:
|
2018-07-29 06:28:50 +08:00
|
|
|
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|