Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise try_at in JSON #1463

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vendorpull https://github.com/sourcemeta/vendorpull 70342aaf458e6cb80baeb5b718901075fc42ede6
noa https://github.com/sourcemeta/noa dee6c859895baf918fe3ecca22e4e7a262c5d500
noa https://github.com/sourcemeta/noa dbc1e2a1acdaf71be1414dc0cae792f45f1f185e
jsontestsuite https://github.com/nst/JSONTestSuite d64aefb55228d9584d3e5b2433f720ea8fd00c82
jsonschema-2020-12 https://github.com/json-schema-org/json-schema-spec 769daad75a9553562333a8937a187741cb708c72
jsonschema-2019-09 https://github.com/json-schema-org/json-schema-spec 41014ea723120ce70b314d72f863c6929d9f3cfd
Expand Down
6 changes: 2 additions & 4 deletions src/json/json_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,7 @@ JSON::at(const String &key,
[[nodiscard]] auto JSON::try_at(const JSON::String &key) const -> const JSON * {
assert(this->is_object());
const auto &object{this->data_object};
const auto value{object.data.find(key, object.data.hash(key))};
return value == object.data.cend() ? nullptr : &value->second;
return object.data.try_at(key, object.data.hash(key));
}

[[nodiscard]] auto
Expand All @@ -678,8 +677,7 @@ JSON::try_at(const String &key,
-> const JSON * {
assert(this->is_object());
const auto &object{this->data_object};
const auto value{object.data.find(key, hash)};
return value == object.data.cend() ? nullptr : &value->second;
return object.data.try_at(key, hash);
}

[[nodiscard]] auto JSON::defines(const JSON::String &key) const -> bool {
Expand Down
23 changes: 23 additions & 0 deletions vendor/noa/src/flat_map/include/sourcemeta/noa/flat_map.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading