mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
Don't bother comparing field names in parserandom
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user