From ea119a567994a90884ac0442e10512c0b34c7a38 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Fri, 5 Feb 2021 14:23:54 -0800 Subject: [PATCH] Start parsing at depth 1 instead of using descend_to for it --- include/simdjson/generic/ondemand/json_iterator-inl.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/simdjson/generic/ondemand/json_iterator-inl.h b/include/simdjson/generic/ondemand/json_iterator-inl.h index ff80c89c..a42934b6 100644 --- a/include/simdjson/generic/ondemand/json_iterator-inl.h +++ b/include/simdjson/generic/ondemand/json_iterator-inl.h @@ -23,10 +23,12 @@ simdjson_really_inline json_iterator::json_iterator(const uint8_t *buf, ondemand : token(buf, _parser->implementation->structural_indexes.get()), parser{_parser}, _string_buf_loc{parser->string_buf.get()}, - _depth{0} + _depth{1} { - // Release the string buf so it can be reused by the next document - descend_to(1); +#if SIMDJSON_API_USAGE_CHECKS + parser->start_positions[0] = token.index; + parser->start_positions[1] = token.index; +#endif logger::log_headers(); }