string_view speed-ups in the JSON related code

This commit is contained in:
Adrian Conlon 2024-03-08 19:17:02 +00:00
parent ef0f8a5654
commit c92c8d768c
2 changed files with 4 additions and 4 deletions

View File

@ -150,9 +150,9 @@ bool checker_t::checkState(test_t test) {
const auto actual_value = std::get<1>(actual);
check("Cycle value", expected_value, actual_value);
const auto expected_action = std::string_view(*expected_data);
const auto& actual_action = std::get<2>(actual);
check("Cycle action", expected_action, std::string_view(actual_action));
const auto expected_action = (*expected_data).get_string();
const auto actual_action = std::get<2>(actual);
check("Cycle action", expected_action.value_unsafe(), actual_action);
}
if (!m_messages.empty())
return false;

View File

@ -11,5 +11,5 @@ public:
cycle_t(const simdjson::dom::array input) noexcept
: byte_t(input) {}
[[nodiscard]] auto action() const noexcept { return std::string(std::string_view(at(2))); }
[[nodiscard]] auto action() const noexcept { return at(2).get_string(); }
};