Merge branch 'master' of https://github.com/lemire/simdjson
This commit is contained in:
commit
682c224d1a
4
Makefile
4
Makefile
|
@ -8,7 +8,7 @@
|
|||
|
||||
CXXFLAGS = -std=c++11 -g2 -O2 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux -Idependencies/double-conversion -Idependencies/rapidjson/include -Ldependencies/double-conversion/release
|
||||
LIBFLAGS = -ldouble-conversion
|
||||
EXECUTABLES=parse jsoncheck minifiercompetition parsingcompetition
|
||||
EXECUTABLES=parse jsoncheck minifiercompetition parsingcompetition parseunified
|
||||
DOUBLEEXECUTABLES=parsedouble jsoncheckdouble parsingcompetitiondouble
|
||||
|
||||
HEADERS=include/jsonparser/jsonparser.h include/jsonparser/common_defs.h include/jsonparser/jsonioutil.h benchmark/benchmark.h benchmark/linux/linux-perf-events.h include/jsonparser/simdjson_internal.h include/jsonparser/stage1_find_marks.h include/jsonparser/stage2_flatten.h include/jsonparser/stage3_ape_machine.h include/jsonparser/stage4_shovel_machine.h include/jsonparser/stage34_unified.h
|
||||
|
@ -39,6 +39,8 @@ 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
|
||||
|
||||
|
||||
parseunified: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parseunified $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS) -DTEST_UNIFIED
|
||||
|
||||
parse: benchmark/parse.cpp $(HEADERS) $(LIBFILES)
|
||||
$(CXX) $(CXXFLAGS) -o parse $(LIBFILES) benchmark/parse.cpp $(LIBFLAGS)
|
||||
|
|
|
@ -46,6 +46,7 @@ int main(int argc, char *argv[]) {
|
|||
int repeat = 10;
|
||||
int volume = p.second;
|
||||
BEST_TIME(json_parse(p.first, p.second, pj), true, , repeat, volume, true);
|
||||
BEST_TIME(json_parse_4stages(p.first, p.second, pj), true, , repeat, volume, true);
|
||||
|
||||
rapidjson::Document d;
|
||||
|
||||
|
|
|
@ -21,3 +21,6 @@ void deallocate_ParsedJson(ParsedJson *pj_ptr);
|
|||
// Parse a document found in buf, need to preallocate ParsedJson.
|
||||
// Return false in case of a failure.
|
||||
bool json_parse(const u8 *buf, size_t len, ParsedJson &pj);
|
||||
|
||||
// like json_parse but users 4 stages, slower.
|
||||
bool json_parse_4stages(const u8 *buf, size_t len, ParsedJson &pj);
|
|
@ -44,8 +44,9 @@ void deallocate_ParsedJson(ParsedJson *pj_ptr) {
|
|||
delete pj_ptr;
|
||||
}
|
||||
|
||||
// parse a document found in buf, need to preallocate ParsedJson.
|
||||
bool json_parse(const u8 *buf, size_t len, ParsedJson &pj) {
|
||||
// parse a document found in buf, need to preallocate ParsedJson.
|
||||
// this can probably be considered a legacy function at this point.
|
||||
bool json_parse_4stages(const u8 *buf, size_t len, ParsedJson &pj) {
|
||||
if (pj.bytecapacity < len) {
|
||||
std::cerr << "Your ParsedJson cannot support documents that big: " << len
|
||||
<< std::endl;
|
||||
|
@ -63,3 +64,21 @@ bool json_parse(const u8 *buf, size_t len, ParsedJson &pj) {
|
|||
}
|
||||
return isok;
|
||||
}
|
||||
|
||||
// parse a document found in buf, need to preallocate ParsedJson.
|
||||
bool json_parse(const u8 *buf, size_t len, ParsedJson &pj) {
|
||||
if (pj.bytecapacity < len) {
|
||||
std::cerr << "Your ParsedJson cannot support documents that big: " << len
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
bool isok = find_structural_bits(buf, len, pj);
|
||||
if (isok) {
|
||||
isok = flatten_indexes(len, pj);
|
||||
}
|
||||
if (isok) {
|
||||
isok = unified_machine(buf, len, pj);
|
||||
}
|
||||
return isok;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue