Added another ref.
This commit is contained in:
parent
7647cb2e49
commit
bbff6c3edb
|
@ -7,3 +7,6 @@
|
|||
[submodule "dependencies/json11"]
|
||||
path = dependencies/json11
|
||||
url = https://github.com/dropbox/json11.git
|
||||
[submodule "dependencies/fastjson"]
|
||||
path = dependencies/fastjson
|
||||
url = https://github.com/mikeando/fastjson.git
|
||||
|
|
5
Makefile
5
Makefile
|
@ -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 -Idependencies/json11
|
||||
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
|
||||
|
||||
ifeq ($(SANITIZE),1)
|
||||
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||
|
@ -25,6 +25,7 @@ MINIFIERLIBFILES=src/jsonminifier.cpp
|
|||
RAPIDJSON_INCLUDE:=dependencies/rapidjson/include
|
||||
SAJSON_INCLUDE:=dependencies/sajson/include
|
||||
JSON11_INCLUDE:=dependencies/json11/json11.hpp
|
||||
FASTJSON_INCLUDE:=dependencies/include/fastjson/fastjson.h
|
||||
|
||||
LIBS=$(RAPIDJSON_INCLUDE) $(SAJSON_INCLUDE)
|
||||
|
||||
|
@ -49,6 +50,8 @@ $(RAPIDJSON_INCLUDE):
|
|||
$(JSON11_INCLUDE):
|
||||
git submodule update --init --recursive
|
||||
|
||||
$(FASTJSON_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
|
||||
|
|
|
@ -11,13 +11,25 @@
|
|||
#include "rapidjson/writer.h"
|
||||
#include "json11.cpp"
|
||||
#include "sajson.h"
|
||||
|
||||
|
||||
#include "fastjson.cpp"
|
||||
#include "fastjson_dom.cpp"
|
||||
|
||||
|
||||
using namespace rapidjson;
|
||||
using namespace std;
|
||||
|
||||
|
||||
// fastjson has a tricky interface
|
||||
void on_json_error( void *, const fastjson::ErrorContext& ec) {
|
||||
std::cerr<<"ERROR: "<<ec.mesg<<std::endl;
|
||||
}
|
||||
bool fastjson_parse(const char *input) {
|
||||
fastjson::Token token;
|
||||
fastjson::dom::Chunk chunk;
|
||||
std::string error_message;
|
||||
return fastjson::dom::parse_string(input, &token, &chunk, 0, &on_json_error, NULL);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc < 2) {
|
||||
cerr << "Usage: " << argv[0] << " <jsonfile>\n";
|
||||
|
@ -49,7 +61,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
int repeat = 10;
|
||||
int volume = p.second;
|
||||
BEST_TIME("json_parse", json_parse(p.first, p.second, pj), true, , repeat, volume, true);
|
||||
BEST_TIME("simdjson", json_parse(p.first, p.second, pj), true, , repeat, volume, true);
|
||||
|
||||
rapidjson::Document d;
|
||||
|
||||
|
@ -72,7 +84,7 @@ int main(int argc, char *argv[]) {
|
|||
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);
|
||||
BEST_TIME("fastjson ", fastjson_parse(buffer), true, memcpy(buffer, p.first, p.second), repeat, volume, true);
|
||||
free(p.first);
|
||||
free(ast_buffer);
|
||||
deallocate_ParsedJson(pj_ptr);
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 485f994a61a64ac73fa6a40d4d639b99b463563b
|
Loading…
Reference in New Issue