Added dropbox

This commit is contained in:
Daniel Lemire 2018-11-20 14:09:43 -05:00
parent 1fcd2688f8
commit 7647cb2e49
4 changed files with 12 additions and 3 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "dependencies/sajson"]
path = dependencies/sajson
url = https://github.com/chadaustin/sajson.git
[submodule "dependencies/json11"]
path = dependencies/json11
url = https://github.com/dropbox/json11.git

View File

@ -6,7 +6,7 @@
.PHONY: clean cleandist
CXXFLAGS = -std=c++11 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux -Idependencies/rapidjson/include -Idependencies/sajson/include
CXXFLAGS = -std=c++11 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/json11
ifeq ($(SANITIZE),1)
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
@ -24,7 +24,7 @@ MINIFIERLIBFILES=src/jsonminifier.cpp
RAPIDJSON_INCLUDE:=dependencies/rapidjson/include
SAJSON_INCLUDE:=dependencies/sajson/include
JSON11_INCLUDE:=dependencies/json11/json11.hpp
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE)
@ -46,6 +46,9 @@ $(SAJSON_INCLUDE):
$(RAPIDJSON_INCLUDE):
git submodule update --init --recursive
$(JSON11_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

View File

@ -9,7 +9,7 @@
#include "rapidjson/reader.h" // you have to check in the submodule
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
#include "json11.cpp"
#include "sajson.h"
@ -69,6 +69,8 @@ int main(int argc, char *argv[]) {
size_t * ast_buffer = (size_t *) malloc(astbuffersize * sizeof(size_t));
BEST_TIME("sajson (static alloc)", sajson::parse(sajson::bounded_allocation(ast_buffer, astbuffersize), sajson::mutable_string_view(p.second, buffer)).is_valid(), true, memcpy(buffer, p.first, p.second), repeat, volume, true);
std::string json11err;
BEST_TIME("dropbox (json11) ", json11::Json::parse(buffer,json11err).is_null(), false, memcpy(buffer, p.first, p.second), repeat, volume, true);
free(buffer);
free(p.first);

1
dependencies/json11 vendored Submodule

@ -0,0 +1 @@
Subproject commit ec4e45219af1d7cde3d58b49ed762376fccf1ace