Added dependencies.
This commit is contained in:
parent
bbff6c3edb
commit
e4d4158e3f
|
@ -10,3 +10,9 @@
|
|||
[submodule "dependencies/fastjson"]
|
||||
path = dependencies/fastjson
|
||||
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
|
||||
|
||||
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)
|
||||
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||
CFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||
else
|
||||
CXXFLAGS += -O3
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
EXECUTABLES=parse jsoncheck numberparsingcheck stringparsingcheck minifiercompetition parsingcompetition minify allparserscheckfile
|
||||
|
@ -26,9 +29,11 @@ RAPIDJSON_INCLUDE:=dependencies/rapidjson/include
|
|||
SAJSON_INCLUDE:=dependencies/sajson/include
|
||||
JSON11_INCLUDE:=dependencies/json11/json11.hpp
|
||||
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)
|
||||
|
||||
test: jsoncheck numberparsingcheck stringparsingcheck
|
||||
|
@ -53,6 +58,12 @@ $(JSON11_INCLUDE):
|
|||
$(FASTJSON_INCLUDE):
|
||||
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)
|
||||
$(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)
|
||||
$(CXX) $(CXXFLAGS) -o minify $(MINIFIERLIBFILES) $(LIBFILES) tools/minify.cpp -I.
|
||||
|
||||
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp -I. $(LIBFLAGS)
|
||||
ujdecode.o: $(UJSON4C_INCLUDE)
|
||||
$(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)
|
||||
$(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
|
||||
|
||||
clean:
|
||||
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
||||
rm -f $(OBJECTS) $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
||||
|
||||
cleandist:
|
||||
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
||||
rm -f $(OBJECTS) $(EXECUTABLES) $(EXTRA_EXECUTABLES)
|
||||
|
|
|
@ -13,8 +13,13 @@
|
|||
#include "sajson.h"
|
||||
#include "fastjson.cpp"
|
||||
#include "fastjson_dom.cpp"
|
||||
#include "gason.cpp"
|
||||
extern "C"
|
||||
{
|
||||
#include "ultrajsondec.c"
|
||||
#include "ujdecode.h"
|
||||
|
||||
|
||||
}
|
||||
using namespace rapidjson;
|
||||
using namespace std;
|
||||
|
||||
|
@ -29,6 +34,7 @@ bool fastjson_parse(const char *input) {
|
|||
std::string error_message;
|
||||
return fastjson::dom::parse_string(input, &token, &chunk, 0, &on_json_error, NULL);
|
||||
}
|
||||
// end of fastjson stuff
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
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("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(ast_buffer);
|
||||
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