Added dependencies.
This commit is contained in:
parent
bbff6c3edb
commit
e4d4158e3f
|
@ -10,3 +10,9 @@
|
||||||
[submodule "dependencies/fastjson"]
|
[submodule "dependencies/fastjson"]
|
||||||
path = dependencies/fastjson
|
path = dependencies/fastjson
|
||||||
url = https://github.com/mikeando/fastjson.git
|
url = https://github.com/mikeando/fastjson.git
|
||||||
|
[submodule "dependencies/gason"]
|
||||||
|
path = dependencies/gason
|
||||||
|
url = https://github.com/vivkin/gason.git
|
||||||
|
[submodule "dependencies/ujson4c"]
|
||||||
|
path = dependencies/ujson4c
|
||||||
|
url = https://github.com/esnme/ujson4c.git
|
||||||
|
|
30
Makefile
30
Makefile
|
@ -6,12 +6,15 @@
|
||||||
|
|
||||||
.PHONY: clean cleandist
|
.PHONY: clean cleandist
|
||||||
|
|
||||||
CXXFLAGS = -std=c++11 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/json11 -Idependencies/fastjson/src -Idependencies/fastjson/include
|
DEPSINCLUDE = -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/json11 -Idependencies/fastjson/src -Idependencies/fastjson/include -Idependencies/gason/src -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
|
||||||
|
CXXFLAGS = -std=c++11 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux $(DEPSINCLUDE)
|
||||||
|
CFLAGS = -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
|
||||||
ifeq ($(SANITIZE),1)
|
ifeq ($(SANITIZE),1)
|
||||||
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||||
|
CFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||||
else
|
else
|
||||||
CXXFLAGS += -O3
|
CXXFLAGS += -O3
|
||||||
|
CFLAGS += -O3
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXECUTABLES=parse jsoncheck numberparsingcheck stringparsingcheck minifiercompetition parsingcompetition minify allparserscheckfile
|
EXECUTABLES=parse jsoncheck numberparsingcheck stringparsingcheck minifiercompetition parsingcompetition minify allparserscheckfile
|
||||||
|
@ -26,9 +29,11 @@ RAPIDJSON_INCLUDE:=dependencies/rapidjson/include
|
||||||
SAJSON_INCLUDE:=dependencies/sajson/include
|
SAJSON_INCLUDE:=dependencies/sajson/include
|
||||||
JSON11_INCLUDE:=dependencies/json11/json11.hpp
|
JSON11_INCLUDE:=dependencies/json11/json11.hpp
|
||||||
FASTJSON_INCLUDE:=dependencies/include/fastjson/fastjson.h
|
FASTJSON_INCLUDE:=dependencies/include/fastjson/fastjson.h
|
||||||
|
GASON_INCLUDE:=dependencies/gason/src/gason.h
|
||||||
|
UJSON4C_INCLUDE:=dependencies/ujson4c/src/ujdecode.c
|
||||||
|
|
||||||
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE)
|
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE)
|
||||||
|
OBJECTS=ujdecode.o
|
||||||
all: $(LIBS) $(EXECUTABLES)
|
all: $(LIBS) $(EXECUTABLES)
|
||||||
|
|
||||||
test: jsoncheck numberparsingcheck stringparsingcheck
|
test: jsoncheck numberparsingcheck stringparsingcheck
|
||||||
|
@ -53,6 +58,12 @@ $(JSON11_INCLUDE):
|
||||||
$(FASTJSON_INCLUDE):
|
$(FASTJSON_INCLUDE):
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
$(GASON_INCLUDE):
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
$(UJSON4C_INCLUDE):
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
bench: benchmarks/bench.cpp $(RAPIDJSON_INCLUDE) $(HEADERS)
|
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
|
$(CXX) -std=c++11 -O3 -o $@ benchmarks/bench.cpp -I$(RAPIDJSON_INCLUDE) -Iinclude -march=native -lm -Wall -Wextra -Wno-narrowing
|
||||||
|
|
||||||
|
@ -77,8 +88,11 @@ minifiercompetition: benchmark/minifiercompetition.cpp $(HEADERS) $(MINIFIERHEAD
|
||||||
minify: tools/minify.cpp $(HEADERS) $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
|
minify: tools/minify.cpp $(HEADERS) $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
|
||||||
$(CXX) $(CXXFLAGS) -o minify $(MINIFIERLIBFILES) $(LIBFILES) tools/minify.cpp -I.
|
$(CXX) $(CXXFLAGS) -o minify $(MINIFIERLIBFILES) $(LIBFILES) tools/minify.cpp -I.
|
||||||
|
|
||||||
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES)
|
ujdecode.o: $(UJSON4C_INCLUDE)
|
||||||
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp -I. $(LIBFLAGS)
|
$(CC) $(CFLAGS) -c dependencies/ujson4c/src/ujdecode.c
|
||||||
|
|
||||||
|
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES) $(OBJECTS)
|
||||||
|
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp ujdecode.o -I. $(LIBFLAGS)
|
||||||
|
|
||||||
allparserscheckfile: tests/allparserscheckfile.cpp $(HEADERS) $(LIBFILES)
|
allparserscheckfile: tests/allparserscheckfile.cpp $(HEADERS) $(LIBFILES)
|
||||||
$(CXX) $(CXXFLAGS) -o allparserscheckfile $(LIBFILES) tests/allparserscheckfile.cpp -I. $(LIBFLAGS)
|
$(CXX) $(CXXFLAGS) -o allparserscheckfile $(LIBFILES) tests/allparserscheckfile.cpp -I. $(LIBFLAGS)
|
||||||
|
@ -87,7 +101,7 @@ parsehisto: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
||||||
$(CXX) $(CXXFLAGS) -o parsehisto benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS) -DBUILDHISTOGRAM
|
$(CXX) $(CXXFLAGS) -o parsehisto benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS) -DBUILDHISTOGRAM
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
rm -f $(OBJECTS) $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
||||||
|
|
||||||
cleandist:
|
cleandist:
|
||||||
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
rm -f $(OBJECTS) $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
||||||
|
|
|
@ -13,8 +13,13 @@
|
||||||
#include "sajson.h"
|
#include "sajson.h"
|
||||||
#include "fastjson.cpp"
|
#include "fastjson.cpp"
|
||||||
#include "fastjson_dom.cpp"
|
#include "fastjson_dom.cpp"
|
||||||
|
#include "gason.cpp"
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include "ultrajsondec.c"
|
||||||
|
#include "ujdecode.h"
|
||||||
|
|
||||||
|
}
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -29,6 +34,7 @@ bool fastjson_parse(const char *input) {
|
||||||
std::string error_message;
|
std::string error_message;
|
||||||
return fastjson::dom::parse_string(input, &token, &chunk, 0, &on_json_error, NULL);
|
return fastjson::dom::parse_string(input, &token, &chunk, 0, &on_json_error, NULL);
|
||||||
}
|
}
|
||||||
|
// end of fastjson stuff
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
|
@ -85,6 +91,12 @@ int main(int argc, char *argv[]) {
|
||||||
BEST_TIME("dropbox (json11) ", json11::Json::parse(buffer,json11err).is_null(), false, memcpy(buffer, p.first, p.second), repeat, volume, true);
|
BEST_TIME("dropbox (json11) ", json11::Json::parse(buffer,json11err).is_null(), false, memcpy(buffer, p.first, p.second), repeat, volume, true);
|
||||||
|
|
||||||
BEST_TIME("fastjson ", fastjson_parse(buffer), true, memcpy(buffer, p.first, p.second), repeat, volume, true);
|
BEST_TIME("fastjson ", fastjson_parse(buffer), true, memcpy(buffer, p.first, p.second), repeat, volume, true);
|
||||||
|
JsonValue value;
|
||||||
|
JsonAllocator allocator;
|
||||||
|
char *endptr;
|
||||||
|
BEST_TIME("gason ", jsonParse(buffer, &endptr, &value, allocator), JSON_OK, memcpy(buffer, p.first, p.second), repeat, volume, true);
|
||||||
|
void *state;
|
||||||
|
BEST_TIME("ultrajson ", (UJDecode(buffer, p.second, NULL, &state) == NULL), false, memcpy(buffer, p.first, p.second), repeat, volume, true);
|
||||||
free(p.first);
|
free(p.first);
|
||||||
free(ast_buffer);
|
free(ast_buffer);
|
||||||
deallocate_ParsedJson(pj_ptr);
|
deallocate_ParsedJson(pj_ptr);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 7aee524189da1c1ecd19f67981e3d903dae25470
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit e14f3fd5207fe30d1bdea723f260609e69d1abfa
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue