Skip to content

Commit e4d4158

Browse files
committed
Added dependencies.
1 parent bbff6c3 commit e4d4158

File tree

6 files changed

+47897
-9
lines changed

6 files changed

+47897
-9
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@
1010
[submodule "dependencies/fastjson"]
1111
path = dependencies/fastjson
1212
url = https://github.com/mikeando/fastjson.git
13+
[submodule "dependencies/gason"]
14+
path = dependencies/gason
15+
url = https://github.com/vivkin/gason.git
16+
[submodule "dependencies/ujson4c"]
17+
path = dependencies/ujson4c
18+
url = https://github.com/esnme/ujson4c.git

Makefile

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66

77
.PHONY: clean cleandist
88

9-
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
10-
9+
DEPSINCLUDE = -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/json11 -Idependencies/fastjson/src -Idependencies/fastjson/include -Idependencies/gason/src -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
10+
CXXFLAGS = -std=c++11 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux $(DEPSINCLUDE)
11+
CFLAGS = -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
1112
ifeq ($(SANITIZE),1)
1213
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
14+
CFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
1315
else
1416
CXXFLAGS += -O3
17+
CFLAGS += -O3
1518
endif
1619

1720
EXECUTABLES=parse jsoncheck numberparsingcheck stringparsingcheck minifiercompetition parsingcompetition minify allparserscheckfile
@@ -26,9 +29,11 @@ RAPIDJSON_INCLUDE:=dependencies/rapidjson/include
2629
SAJSON_INCLUDE:=dependencies/sajson/include
2730
JSON11_INCLUDE:=dependencies/json11/json11.hpp
2831
FASTJSON_INCLUDE:=dependencies/include/fastjson/fastjson.h
32+
GASON_INCLUDE:=dependencies/gason/src/gason.h
33+
UJSON4C_INCLUDE:=dependencies/ujson4c/src/ujdecode.c
2934

30-
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE)
31-
35+
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE) $(JSON11_INCLUDE) $(FASTJSON_INCLUDE) $(GASON_INCLUDE) $(UJSON4C_INCLUDE)
36+
OBJECTS=ujdecode.o
3237
all: $(LIBS) $(EXECUTABLES)
3338

3439
test: jsoncheck numberparsingcheck stringparsingcheck
@@ -53,6 +58,12 @@ $(JSON11_INCLUDE):
5358
$(FASTJSON_INCLUDE):
5459
git submodule update --init --recursive
5560

61+
$(GASON_INCLUDE):
62+
git submodule update --init --recursive
63+
64+
$(UJSON4C_INCLUDE):
65+
git submodule update --init --recursive
66+
5667
bench: benchmarks/bench.cpp $(RAPIDJSON_INCLUDE) $(HEADERS)
5768
$(CXX) -std=c++11 -O3 -o $@ benchmarks/bench.cpp -I$(RAPIDJSON_INCLUDE) -Iinclude -march=native -lm -Wall -Wextra -Wno-narrowing
5869

@@ -77,8 +88,11 @@ minifiercompetition: benchmark/minifiercompetition.cpp $(HEADERS) $(MINIFIERHEAD
7788
minify: tools/minify.cpp $(HEADERS) $(MINIFIERHEADERS) $(LIBFILES) $(MINIFIERLIBFILES)
7889
$(CXX) $(CXXFLAGS) -o minify $(MINIFIERLIBFILES) $(LIBFILES) tools/minify.cpp -I.
7990

80-
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES)
81-
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp -I. $(LIBFLAGS)
91+
ujdecode.o: $(UJSON4C_INCLUDE)
92+
$(CC) $(CFLAGS) -c dependencies/ujson4c/src/ujdecode.c
93+
94+
parsingcompetition: benchmark/parsingcompetition.cpp $(HEADERS) $(LIBFILES) $(OBJECTS)
95+
$(CXX) $(CXXFLAGS) -o parsingcompetition $(LIBFILES) benchmark/parsingcompetition.cpp ujdecode.o -I. $(LIBFLAGS)
8296

8397
allparserscheckfile: tests/allparserscheckfile.cpp $(HEADERS) $(LIBFILES)
8498
$(CXX) $(CXXFLAGS) -o allparserscheckfile $(LIBFILES) tests/allparserscheckfile.cpp -I. $(LIBFLAGS)
@@ -87,7 +101,7 @@ parsehisto: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
87101
$(CXX) $(CXXFLAGS) -o parsehisto benchmark/parse.cpp $(LIBFILES) $(LIBFLAGS) -DBUILDHISTOGRAM
88102

89103
clean:
90-
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
104+
rm -f $(OBJECTS) $(EXECUTABLES) $(EXTRA_EXECUTABLES)
91105

92106
cleandist:
93-
rm -f $(EXECUTABLES) $(EXTRA_EXECUTABLES)
107+
rm -f $(OBJECTS) $(EXECUTABLES) $(EXTRA_EXECUTABLES)

benchmark/parsingcompetition.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313
#include "sajson.h"
1414
#include "fastjson.cpp"
1515
#include "fastjson_dom.cpp"
16+
#include "gason.cpp"
17+
extern "C"
18+
{
19+
#include "ultrajsondec.c"
20+
#include "ujdecode.h"
1621

17-
22+
}
1823
using namespace rapidjson;
1924
using namespace std;
2025

@@ -29,6 +34,7 @@ bool fastjson_parse(const char *input) {
2934
std::string error_message;
3035
return fastjson::dom::parse_string(input, &token, &chunk, 0, &on_json_error, NULL);
3136
}
37+
// end of fastjson stuff
3238

3339
int main(int argc, char *argv[]) {
3440
if (argc < 2) {
@@ -85,6 +91,12 @@ int main(int argc, char *argv[]) {
8591
BEST_TIME("dropbox (json11) ", json11::Json::parse(buffer,json11err).is_null(), false, memcpy(buffer, p.first, p.second), repeat, volume, true);
8692

8793
BEST_TIME("fastjson ", fastjson_parse(buffer), true, memcpy(buffer, p.first, p.second), repeat, volume, true);
94+
JsonValue value;
95+
JsonAllocator allocator;
96+
char *endptr;
97+
BEST_TIME("gason ", jsonParse(buffer, &endptr, &value, allocator), JSON_OK, memcpy(buffer, p.first, p.second), repeat, volume, true);
98+
void *state;
99+
BEST_TIME("ultrajson ", (UJDecode(buffer, p.second, NULL, &state) == NULL), false, memcpy(buffer, p.first, p.second), repeat, volume, true);
88100
free(p.first);
89101
free(ast_buffer);
90102
deallocate_ParsedJson(pj_ptr);

dependencies/gason

Submodule gason added at 7aee524

dependencies/ujson4c

Submodule ujson4c added at e14f3fd

jsonexamples/marine_ik.json

Lines changed: 47854 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)