Don't bother comparing field names in parserandom

This commit is contained in:
John Keiser
2020-08-19 15:34:04 -07:00
parent ebcb3c6b3b
commit 5cf68416d8
2 changed files with 10 additions and 4 deletions
+4 -4
View File
@@ -269,8 +269,8 @@ static void dom_parse_largerandom(State &state) {
std::cerr << "failure: " << error << std::endl;
throw "Parsing failed";
};
for (auto p : doc) {
container.emplace_back(my_point{p["x"], p["y"], p["z"]});
for (auto point : doc) {
container.emplace_back(my_point{point["x"], point["y"], point["z"]});
}
bytes += json.size();
benchmark::DoNotOptimize(container.data());
@@ -308,8 +308,8 @@ static void ondemand_parse_largerandom(State &state) {
size_t bytes = 0;
for (SIMDJSON_UNUSED auto _ : state) {
std::vector<my_point> container;
for (ondemand::object p : parser.parse(json)) {
container.emplace_back(my_point{p["x"], p["y"], p["z"]});
for (ondemand::object point : parser.parse(json)) {
container.emplace_back(my_point{(*point).value(), (*++point).value(), (*++point).value()});
}
bytes += json.size();
benchmark::DoNotOptimize(container.data());
+6
View File
@@ -133,6 +133,12 @@ simdjson_really_inline object object::end() noexcept {
}
simdjson_really_inline simdjson_result<field> object::operator*() noexcept {
// For people who use the iterator raw
if (at_start) { first_field(); }
if (finished()) {
logger::log_error(doc->iter, "Attempt to get field from empty object");
return { doc, NO_SUCH_FIELD };
}
if (error) { finish(); return { doc, error }; }
return field::start(doc);
}