Skip to content

Commit

Permalink
Namespace JSON-related errors (#1499)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti authored Jan 28, 2025
1 parent d1039b8 commit 2492e5e
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 51 deletions.
8 changes: 4 additions & 4 deletions src/core/json/include/sourcemeta/core/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace sourcemeta::core {
/// assert(document.is_array());
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
/// If parsing fails, sourcemeta::core::JSONParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto parse_json(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
const JSON::ParseCallback &callback = nullptr) -> JSON;
Expand All @@ -63,7 +63,7 @@ auto parse_json(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
/// assert(document.is_array());
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
/// If parsing fails, sourcemeta::core::JSONParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto parse_json(const std::basic_string<JSON::Char, JSON::CharTraits> &input,
const JSON::ParseCallback &callback = nullptr) -> JSON;
Expand Down Expand Up @@ -125,7 +125,7 @@ auto parse_json(const std::basic_string<JSON::Char, JSON::CharTraits> &input,
/// std::cout << std::endl;
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
/// If parsing fails, sourcemeta::core::JSONParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto read_json(const std::filesystem::path &path) -> JSON;

Expand All @@ -147,7 +147,7 @@ auto read_json(const std::filesystem::path &path) -> JSON;
/// std::cout << std::endl;
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
/// If parsing fails, sourcemeta::core::JSONParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto read_file(const std::filesystem::path &path)
-> std::basic_ifstream<JSON::Char, JSON::CharTraits>;
Expand Down
17 changes: 9 additions & 8 deletions src/core/json/include/sourcemeta/core/json_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ namespace sourcemeta::core {

/// @ingroup json
/// This class represents a parsing error
class SOURCEMETA_CORE_JSON_EXPORT ParseError : public std::exception {
class SOURCEMETA_CORE_JSON_EXPORT JSONParseError : public std::exception {
public:
/// Create a parsing error
ParseError(const std::uint64_t line, const std::uint64_t column)
JSONParseError(const std::uint64_t line, const std::uint64_t column)
: line_{line}, column_{column} {}

[[nodiscard]] auto what() const noexcept -> const char * override {
Expand All @@ -45,16 +45,17 @@ class SOURCEMETA_CORE_JSON_EXPORT ParseError : public std::exception {

/// @ingroup json
/// This class represents a parsing error occurring from parsing a file
class SOURCEMETA_CORE_JSON_EXPORT FileParseError : public ParseError {
class SOURCEMETA_CORE_JSON_EXPORT JSONFileParseError : public JSONParseError {
public:
/// Create a file parsing error
FileParseError(const std::filesystem::path &path, const std::uint64_t line,
const std::uint64_t column)
: ParseError{line, column}, path_{path} {}
JSONFileParseError(const std::filesystem::path &path,
const std::uint64_t line, const std::uint64_t column)
: JSONParseError{line, column}, path_{path} {}

/// Create a file parsing error from a parse error
FileParseError(const std::filesystem::path &path, const ParseError &parent)
: ParseError{parent.line(), parent.column()}, path_{path} {}
JSONFileParseError(const std::filesystem::path &path,
const JSONParseError &parent)
: JSONParseError{parent.line(), parent.column()}, path_{path} {}

/// Get the fiel path of the error
[[nodiscard]] auto path() const noexcept -> const std::filesystem::path {
Expand Down
4 changes: 2 additions & 2 deletions src/core/json/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ auto read_json(const std::filesystem::path &path) -> JSON {
auto stream{read_file(path)};
try {
return parse_json(stream);
} catch (const ParseError &error) {
} catch (const JSONParseError &error) {
// For producing better error messages
throw FileParseError(path, error);
throw JSONFileParseError(path, error);
}
}

Expand Down
46 changes: 23 additions & 23 deletions src/core/json/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ inline auto parse_null(
1)) {
column += 1;
if (stream.get() != character) {
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand All @@ -45,7 +45,7 @@ inline auto parse_boolean_true(
1)) {
column += 1;
if (stream.get() != character) {
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand All @@ -62,7 +62,7 @@ inline auto parse_boolean_false(
1)) {
column += 1;
if (stream.get() != character) {
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -97,7 +97,7 @@ auto parse_string_unicode_code_point(
if (std::isxdigit(code_point[code_point_size])) {
code_point_size += 1;
} else {
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -127,13 +127,13 @@ auto parse_string_unicode(
// Next, we expect "\"
column += 1;
if (stream.get() != internal::token_string_escape<CharT>) {
throw ParseError(line, column);
throw JSONParseError(line, column);
}

// Next, we expect "u"
column += 1;
if (stream.get() != internal::token_string_escape_unicode<CharT>) {
throw ParseError(line, column);
throw JSONParseError(line, column);
}

// Finally, get the low code point of the surrogate and calculate
Expand All @@ -147,7 +147,7 @@ auto parse_string_unicode(
code_point =
0x10000 + ((code_point - 0xD800) << 10) + (low_code_point - 0xDC00);
} else {
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -218,7 +218,7 @@ auto parse_string_escape(
return;

default:
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -276,14 +276,14 @@ auto parse_string(
case '\u001E':
case '\u001F':
case static_cast<typename JSON::Char>(JSON::CharTraits::eof()):
throw ParseError(line, column);
throw JSONParseError(line, column);
default:
result.put(character);
break;
}
}

throw ParseError(line, column);
throw JSONParseError(line, column);
}

template <typename CharT, typename Traits>
Expand All @@ -293,7 +293,7 @@ auto parse_number_integer(const std::uint64_t line, const std::uint64_t column,
try {
return std::stoll(string);
} catch (const std::out_of_range &) {
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand All @@ -304,7 +304,7 @@ auto parse_number_real(const std::uint64_t line, const std::uint64_t column,
try {
return std::stod(string);
} catch (const std::out_of_range &) {
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -338,7 +338,7 @@ auto parse_number_exponent_rest(
}
}

throw ParseError(line, column);
throw JSONParseError(line, column);
}

auto parse_number_exponent(
Expand Down Expand Up @@ -366,7 +366,7 @@ auto parse_number_exponent(
return parse_number_exponent_rest(line, column, original_column, stream,
result);
default:
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -405,7 +405,7 @@ auto parse_number_exponent_first(
return parse_number_exponent_rest(line, column, original_column, stream,
result);
default:
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -450,7 +450,7 @@ auto parse_number_fractional(
}
}

throw ParseError(line, column);
throw JSONParseError(line, column);
}

auto parse_number_fractional_first(
Expand All @@ -469,7 +469,7 @@ auto parse_number_fractional_first(
case internal::token_number_decimal_point<typename JSON::Char>:
case static_cast<typename JSON::Char>(JSON::CharTraits::eof()):
column += 1;
throw ParseError(line, column);
throw JSONParseError(line, column);
case internal::token_number_zero<typename JSON::Char>:
case internal::token_number_one<typename JSON::Char>:
case internal::token_number_two<typename JSON::Char>:
Expand Down Expand Up @@ -526,7 +526,7 @@ auto parse_number_maybe_fractional(
case internal::token_number_eight<typename JSON::Char>:
case internal::token_number_nine<typename JSON::Char>:
column += 1;
throw ParseError(line, column);
throw JSONParseError(line, column);
default:
return JSON{parse_number_integer(line, original_column, result.str())};
}
Expand Down Expand Up @@ -578,7 +578,7 @@ auto parse_number_any_rest(
}
}

throw ParseError(line, column);
throw JSONParseError(line, column);
}

auto parse_number_any_negative_first(
Expand Down Expand Up @@ -612,7 +612,7 @@ auto parse_number_any_negative_first(
return parse_number_any_rest(line, column, original_column, stream,
result);
default:
throw ParseError(line, column);
throw JSONParseError(line, column);
}
}

Expand Down Expand Up @@ -783,7 +783,7 @@ auto internal_parse_json(
case internal::token_whitespace_space<typename JSON::Char>:
goto do_parse;
default:
throw ParseError(line, column);
throw JSONParseError(line, column);
}

/*
Expand Down Expand Up @@ -828,7 +828,7 @@ auto internal_parse_json(
CALLBACK_POST(Array, frames.top().get());
goto do_parse_container_end;
} else {
throw ParseError(line, column);
throw JSONParseError(line, column);
}

// Values
Expand Down Expand Up @@ -1172,7 +1172,7 @@ auto internal_parse_json(
frames.pop();
}

throw ParseError(line, column);
throw JSONParseError(line, column);

do_parse_container_end:
assert(!levels.empty());
Expand Down
2 changes: 1 addition & 1 deletion src/core/jsonl/include/sourcemeta/core/jsonl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SOURCEMETA_CORE_JSONL_EXPORT JSONL {
/// }
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
/// If parsing fails, sourcemeta::core::JSONParseError will be thrown.
JSONL(std::basic_istream<JSON::Char, JSON::CharTraits> &stream);

using const_iterator = ConstJSONLIterator;
Expand Down
2 changes: 1 addition & 1 deletion src/core/jsonl/iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ auto ConstJSONLIterator::operator++() -> ConstJSONLIterator & {
goto end;
default:
this->column += 1;
throw ParseError(this->line, this->column);
throw JSONParseError(this->line, this->column);
}

element:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ namespace sourcemeta::core {

/// @ingroup jsonpointer
/// This class represents a parsing error.
class SOURCEMETA_CORE_JSONPOINTER_EXPORT PointerParseError : public ParseError {
class SOURCEMETA_CORE_JSONPOINTER_EXPORT PointerParseError
// TODO: It makes no sense for a JSON Pointer error to inherit from a JSON
// error. Make them independent
: public JSONParseError {
public:
/// Create a parsing error
PointerParseError(const std::uint64_t column) : ParseError{1, column} {}
PointerParseError(const std::uint64_t column) : JSONParseError{1, column} {}

[[nodiscard]] auto what() const noexcept -> const char * override {
return "The input is not a valid JSON Pointer";
Expand Down
2 changes: 1 addition & 1 deletion src/core/yaml/yaml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static auto yaml_node_to_json(yaml_node_t *const node,
// Looks like it is very hard in YAML, given a scalar value, to
// determine whether it is a string or something else without attempting
// to parsing it and potentially failing to do so
} catch (const sourcemeta::core::ParseError &) {
} catch (const sourcemeta::core::JSONParseError &) {
return sourcemeta::core::JSON{input};
}
}
Expand Down
9 changes: 5 additions & 4 deletions test/json/json_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#include <type_traits> // std::is_base_of_v

TEST(JSON_error, parse_error) {
static_assert(std::is_base_of_v<std::exception, sourcemeta::core::ParseError>,
"Must subclass std::exception");
auto exception{sourcemeta::core::ParseError(5, 6)};
EXPECT_THROW(throw exception, sourcemeta::core::ParseError);
static_assert(
std::is_base_of_v<std::exception, sourcemeta::core::JSONParseError>,
"Must subclass std::exception");
auto exception{sourcemeta::core::JSONParseError(5, 6)};
EXPECT_THROW(throw exception, sourcemeta::core::JSONParseError);
EXPECT_EQ(std::string{exception.what()}, "Failed to parse the JSON document");
EXPECT_EQ(exception.line(), 5);
EXPECT_EQ(exception.column(), 6);
Expand Down
4 changes: 2 additions & 2 deletions test/json/json_parse_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
try { \
sourcemeta::core::parse_json((input)); \
FAIL() << "The parse function was expected to throw"; \
} catch (const sourcemeta::core::ParseError &error) { \
} catch (const sourcemeta::core::JSONParseError &error) { \
EXPECT_EQ(error.line(), expected_line); \
EXPECT_EQ(error.column(), expected_column); \
SUCCEED(); \
Expand Down Expand Up @@ -633,7 +633,7 @@ TEST(JSON_parse_error, read_json_invalid) {
try {
sourcemeta::core::read_json(std::filesystem::path{TEST_DIRECTORY} /
"stub_invalid.json");
} catch (const sourcemeta::core::FileParseError &error) {
} catch (const sourcemeta::core::JSONFileParseError &error) {
EXPECT_EQ(error.path(),
std::filesystem::path{TEST_DIRECTORY} / "stub_invalid.json");
EXPECT_EQ(error.line(), 3);
Expand Down
2 changes: 1 addition & 1 deletion test/json/jsontestsuite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class JSONTest : public testing::Test {
while (!stream.eof()) {
sourcemeta::core::parse_json(stream);
}
} catch (const sourcemeta::core::ParseError &) {
} catch (const sourcemeta::core::JSONParseError &) {
SUCCEED();
} catch (const std::exception &) {
FAIL() << "The parse function threw an unexpected error";
Expand Down
2 changes: 1 addition & 1 deletion test/jsonl/jsonl_parse_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
while (iterator != parser.cend()) \
++iterator; \
FAIL() << "The JSONL parser was expected to throw"; \
} catch (const sourcemeta::core::ParseError &error) { \
} catch (const sourcemeta::core::JSONParseError &error) { \
EXPECT_EQ(error.line(), expected_line); \
EXPECT_EQ(error.column(), expected_column); \
SUCCEED(); \
Expand Down
2 changes: 1 addition & 1 deletion test/jsonpointer/jsonpointer_parse_error_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
stream << "\"" << (input) << "\""; \
sourcemeta::core::parse_json(stream.str()); \
FAIL() << "The parse function was expected to throw"; \
} catch (const sourcemeta::core::ParseError &) { \
} catch (const sourcemeta::core::JSONParseError &) { \
SUCCEED(); \
} catch (const std::exception &) { \
FAIL() << "The parse operation threw an unexpected error"; \
Expand Down

5 comments on commit 2492e5e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (macos/llvm)

Benchmark suite Current: 2492e5e Previous: d1039b8 Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 1.8856189495513693 ns/iter 2.272603659912782 ns/iter 0.83
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 1.8246839608306262 ns/iter 2.292447019131944 ns/iter 0.80
Regex_Period_Asterisk 1.7459228306283452 ns/iter 2.13597649445663 ns/iter 0.82
Regex_Group_Period_Asterisk_Group 1.8851535171730374 ns/iter 2.5155558253371537 ns/iter 0.75
Regex_Period_Plus 2.2013061320227347 ns/iter 2.9661443190639707 ns/iter 0.74
Regex_Period 2.2129030761107624 ns/iter 2.9591032337633196 ns/iter 0.75
Regex_Caret_Period_Plus_Dollar 2.244911830670867 ns/iter 2.649880218102814 ns/iter 0.85
Regex_Caret_Group_Period_Plus_Group_Dollar 2.209557324259319 ns/iter 2.899119408415247 ns/iter 0.76
Regex_Caret_Period_Asterisk_Dollar 1.7944728936234418 ns/iter 2.588812324057509 ns/iter 0.69
Regex_Caret_Group_Period_Asterisk_Group_Dollar 1.8014461381733193 ns/iter 2.264736107438064 ns/iter 0.80
Regex_Caret_X_Hyphen 7.570363466811086 ns/iter 9.098641882491895 ns/iter 0.83
Regex_Period_Md_Dollar 76.93690568019085 ns/iter 100.8998583489317 ns/iter 0.76
Regex_Caret_Slash_Period_Asterisk 5.727159036181991 ns/iter 6.378184644628103 ns/iter 0.90
Regex_Caret_Period_Range_Dollar 2.5548133291273087 ns/iter 3.1395645799794774 ns/iter 0.81
Regex_Nested_Backtrack 859.1831207286483 ns/iter 1047.9826508778744 ns/iter 0.82
JSON_Array_Of_Objects_Unique 447.81650535816374 ns/iter 440.1934757700168 ns/iter 1.02
JSON_Parse_1 30876.821651626935 ns/iter 30284.62411968264 ns/iter 1.02
JSON_Fast_Hash_Helm_Chart_Lock 55.259665399347824 ns/iter 63.99578752276005 ns/iter 0.86
JSON_Equality_Helm_Chart_Lock 140.5083316921428 ns/iter 155.923992024792 ns/iter 0.90
JSON_String_Equal/10 8.619044765911262 ns/iter 10.56912447437271 ns/iter 0.82
JSON_String_Equal/100 6.653917902452342 ns/iter 9.364821301284968 ns/iter 0.71
JSON_String_Equal_Small_By_Perfect_Hash/10 0.3534960799707045 ns/iter 0.41239453396608233 ns/iter 0.86
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 3.2694905305951947 ns/iter 3.8704953860071933 ns/iter 0.84
JSON_String_Fast_Hash/10 1.7159200151970297 ns/iter 2.057935356450222 ns/iter 0.83
JSON_String_Fast_Hash/100 2.0696467778598624 ns/iter 2.4879413451627133 ns/iter 0.83
JSON_String_Key_Hash/10 1.424595785921619 ns/iter 1.5778325125852966 ns/iter 0.90
JSON_String_Key_Hash/100 1.4568338982300413 ns/iter 1.6773218966140813 ns/iter 0.87
JSON_Object_Defines_Miss_Same_Length 2.4083469720437387 ns/iter 2.7513182587675784 ns/iter 0.88
JSON_Object_Defines_Miss_Too_Small 2.5330610466434655 ns/iter 2.7463315990630255 ns/iter 0.92
JSON_Object_Defines_Miss_Too_Large 2.5572955262271204 ns/iter 2.815601865018342 ns/iter 0.91
Pointer_Object_Traverse 18.80521106237539 ns/iter 22.383229344936808 ns/iter 0.84
Pointer_Object_Try_Traverse 24.51805309608182 ns/iter 34.39778225139049 ns/iter 0.71
Pointer_Push_Back_Pointer_To_Weak_Pointer 204.3824141833214 ns/iter 232.2348523741067 ns/iter 0.88

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/llvm)

Benchmark suite Current: 2492e5e Previous: d1039b8 Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.2111436203179213 ns/iter 2.220547577887335 ns/iter 1.00
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.2001286520578116 ns/iter 2.247716283883405 ns/iter 0.98
Regex_Period_Asterisk 2.2057711593449443 ns/iter 2.1938147842379876 ns/iter 1.01
Regex_Group_Period_Asterisk_Group 2.210337333220009 ns/iter 2.201862442030673 ns/iter 1.00
Regex_Period_Plus 2.79860324518272 ns/iter 2.7996738933152243 ns/iter 1.00
Regex_Period 2.54788068687906 ns/iter 2.4903684541568527 ns/iter 1.02
Regex_Caret_Period_Plus_Dollar 2.4875050994454475 ns/iter 2.716484945499371 ns/iter 0.92
Regex_Caret_Group_Period_Plus_Group_Dollar 2.4912739317001065 ns/iter 2.488667385071972 ns/iter 1.00
Regex_Caret_Period_Asterisk_Dollar 2.4883480211806366 ns/iter 2.2142646830124773 ns/iter 1.12
Regex_Caret_Group_Period_Asterisk_Group_Dollar 2.493770269034612 ns/iter 2.193481996152133 ns/iter 1.14
Regex_Caret_X_Hyphen 12.597373519372656 ns/iter 13.055306126903075 ns/iter 0.96
Regex_Period_Md_Dollar 81.67422130360217 ns/iter 81.58166798897486 ns/iter 1.00
Regex_Caret_Slash_Period_Asterisk 6.843664463370261 ns/iter 5.603774699785185 ns/iter 1.22
Regex_Caret_Period_Range_Dollar 4.0398475021441325 ns/iter 2.8098367183450117 ns/iter 1.44
Regex_Nested_Backtrack 498.2254229560972 ns/iter 502.30239899997287 ns/iter 0.99
JSON_Array_Of_Objects_Unique 406.11304843484015 ns/iter 405.55829657041426 ns/iter 1.00
JSON_Parse_1 30786.758918731128 ns/iter 30596.74519791165 ns/iter 1.01
JSON_Fast_Hash_Helm_Chart_Lock 59.25685805534612 ns/iter 59.094997287242684 ns/iter 1.00
JSON_Equality_Helm_Chart_Lock 151.41301910369856 ns/iter 151.4245138405844 ns/iter 1.00
JSON_String_Equal/10 7.160517411943075 ns/iter 6.222737949466636 ns/iter 1.15
JSON_String_Equal/100 6.845516395241755 ns/iter 6.848925336962325 ns/iter 1.00
JSON_String_Equal_Small_By_Perfect_Hash/10 0.934837912853127 ns/iter 0.9350277429330012 ns/iter 1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 14.600103510376343 ns/iter 14.60095197943798 ns/iter 1.00
JSON_String_Fast_Hash/10 2.503454074189386 ns/iter 2.4859153100512303 ns/iter 1.01
JSON_String_Fast_Hash/100 2.5050830475110732 ns/iter 2.486031064618272 ns/iter 1.01
JSON_String_Key_Hash/10 2.6937836852284565 ns/iter 2.654999142447869 ns/iter 1.01
JSON_String_Key_Hash/100 1.8681956279413496 ns/iter 1.8666477267403727 ns/iter 1.00
JSON_Object_Defines_Miss_Same_Length 3.733816782716067 ns/iter 3.733899622256243 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Small 3.739712942552505 ns/iter 3.7334115510541594 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Large 3.742022789103254 ns/iter 3.736346402134831 ns/iter 1.00
Pointer_Object_Traverse 44.38466385593775 ns/iter 44.29840964830761 ns/iter 1.00
Pointer_Object_Try_Traverse 52.70601072494114 ns/iter 52.37492310502513 ns/iter 1.01
Pointer_Push_Back_Pointer_To_Weak_Pointer 307.89049472933414 ns/iter 306.90642949558656 ns/iter 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (windows/msvc)

Benchmark suite Current: 2492e5e Previous: d1039b8 Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 7.108755580357443 ns/iter 6.8718649553569024 ns/iter 1.03
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 7.161896205357518 ns/iter 6.8636571428574 ns/iter 1.04
Regex_Period_Asterisk 6.911620535713528 ns/iter 6.974486607142743 ns/iter 0.99
Regex_Group_Period_Asterisk_Group 6.9880392857147715 ns/iter 6.988375000000095 ns/iter 1.00
Regex_Period_Plus 7.430243303572226 ns/iter 7.226108258928982 ns/iter 1.03
Regex_Period 7.182187500000785 ns/iter 7.387556919643703 ns/iter 0.97
Regex_Caret_Period_Plus_Dollar 7.1994531249990645 ns/iter 7.135473214286188 ns/iter 1.01
Regex_Caret_Group_Period_Plus_Group_Dollar 7.207620535713792 ns/iter 7.253243303571974 ns/iter 0.99
Regex_Caret_Period_Asterisk_Dollar 7.026176339285531 ns/iter 6.996428571428887 ns/iter 1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar 7.219255580357091 ns/iter 6.98299553571502 ns/iter 1.03
Regex_Caret_X_Hyphen 14.278049936259428 ns/iter 14.227035204343391 ns/iter 1.00
Regex_Period_Md_Dollar 152.09018963881627 ns/iter 150.2891071428536 ns/iter 1.01
Regex_Caret_Slash_Period_Asterisk 11.128717857143247 ns/iter 10.38084687499996 ns/iter 1.07
Regex_Caret_Period_Range_Dollar 7.540963169642621 ns/iter 7.486743716576887 ns/iter 1.01
Regex_Nested_Backtrack 607.2477678571125 ns/iter 608.3369642856796 ns/iter 1.00
JSON_Array_Of_Objects_Unique 489.9271430657531 ns/iter 491.141263845394 ns/iter 1.00
JSON_Parse_1 79816.39212535575 ns/iter 79810.91517857816 ns/iter 1.00
JSON_Fast_Hash_Helm_Chart_Lock 63.03219642857373 ns/iter 66.33134821427689 ns/iter 0.95
JSON_Equality_Helm_Chart_Lock 189.78781158817978 ns/iter 188.36602574697568 ns/iter 1.01
JSON_String_Equal/10 9.000257812500832 ns/iter 8.985188616071735 ns/iter 1.00
JSON_String_Equal/100 9.913895045027719 ns/iter 9.92287897355859 ns/iter 1.00
JSON_String_Equal_Small_By_Perfect_Hash/10 2.167986250000098 ns/iter 2.174887500000011 ns/iter 1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 14.560082589285223 ns/iter 14.828819196429167 ns/iter 0.98
JSON_String_Fast_Hash/10 4.022034605396982 ns/iter 4.041466123288193 ns/iter 1.00
JSON_String_Fast_Hash/100 4.02836514112216 ns/iter 4.028135319692967 ns/iter 1.00
JSON_String_Key_Hash/10 7.852272286374367 ns/iter 7.935802196715434 ns/iter 0.99
JSON_String_Key_Hash/100 4.023891167899767 ns/iter 4.035108310776726 ns/iter 1.00
JSON_Object_Defines_Miss_Same_Length 3.7200246362141582 ns/iter 3.7559480290077483 ns/iter 0.99
JSON_Object_Defines_Miss_Too_Small 4.9560250000001815 ns/iter 4.967442857143567 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Large 3.417769726039712 ns/iter 3.4380607974321817 ns/iter 0.99
Pointer_Object_Traverse 49.184649999995145 ns/iter 49.39659000000347 ns/iter 1.00
Pointer_Object_Try_Traverse 67.87433035714433 ns/iter 67.81262276785834 ns/iter 1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer 160.0469866071208 ns/iter 162.48794642856572 ns/iter 0.98

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/gcc)

Benchmark suite Current: 2492e5e Previous: d1039b8 Ratio
Pointer_Object_Traverse 45.840627853949435 ns/iter 45.64983324736455 ns/iter 1.00
Pointer_Object_Try_Traverse 26.13607518815556 ns/iter 26.14561696173193 ns/iter 1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer 144.85669455980258 ns/iter 144.98700164498874 ns/iter 1.00
JSON_Array_Of_Objects_Unique 412.2524304452254 ns/iter 414.4424439435892 ns/iter 0.99
JSON_Parse_1 33405.22089953349 ns/iter 33488.16770838592 ns/iter 1.00
JSON_Fast_Hash_Helm_Chart_Lock 62.57066824892936 ns/iter 62.86977271866869 ns/iter 1.00
JSON_Equality_Helm_Chart_Lock 149.4381260936381 ns/iter 150.91060489094605 ns/iter 0.99
JSON_String_Equal/10 6.340375580264439 ns/iter 6.33749663091924 ns/iter 1.00
JSON_String_Equal/100 6.966305243569889 ns/iter 6.967756830455331 ns/iter 1.00
JSON_String_Equal_Small_By_Perfect_Hash/10 0.9334189157887778 ns/iter 0.9336441250683972 ns/iter 1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 14.298650704286915 ns/iter 14.288750528005046 ns/iter 1.00
JSON_String_Fast_Hash/10 0.9448569344788444 ns/iter 0.9328878806972629 ns/iter 1.01
JSON_String_Fast_Hash/100 0.9541443095919708 ns/iter 0.9322742114096909 ns/iter 1.02
JSON_String_Key_Hash/10 1.6717275696396303 ns/iter 1.6761272356245651 ns/iter 1.00
JSON_String_Key_Hash/100 1.983720797669898 ns/iter 1.9835455350792497 ns/iter 1.00
JSON_Object_Defines_Miss_Same_Length 2.545532506863017 ns/iter 2.661097417192496 ns/iter 0.96
JSON_Object_Defines_Miss_Too_Small 2.49058532051174 ns/iter 2.4959629192068467 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Large 3.1181990105767974 ns/iter 3.1085096648253177 ns/iter 1.00
Regex_Lower_S_Or_Upper_S_Asterisk 3.4219505498981047 ns/iter 3.4198403515840377 ns/iter 1.00
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 3.444012936817582 ns/iter 3.4288885296590075 ns/iter 1.00
Regex_Period_Asterisk 3.4289215138699936 ns/iter 3.4215930773693723 ns/iter 1.00
Regex_Group_Period_Asterisk_Group 3.420869897340437 ns/iter 3.4254047160594197 ns/iter 1.00
Regex_Period_Plus 3.741909129075417 ns/iter 3.7345131097394084 ns/iter 1.00
Regex_Period 3.728190787663804 ns/iter 3.7305413376614265 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 3.7287556000011817 ns/iter 3.7342162475184466 ns/iter 1.00
Regex_Caret_Group_Period_Plus_Group_Dollar 3.7288022313854174 ns/iter 4.215419201107587 ns/iter 0.88
Regex_Caret_Period_Asterisk_Dollar 4.6624720066537355 ns/iter 4.661344183754675 ns/iter 1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar 4.671795372669684 ns/iter 4.660717727100717 ns/iter 1.00
Regex_Caret_X_Hyphen 12.433011596993488 ns/iter 13.143488127108597 ns/iter 0.95
Regex_Period_Md_Dollar 88.81716107595766 ns/iter 93.38737598994702 ns/iter 0.95
Regex_Caret_Slash_Period_Asterisk 8.080493550850028 ns/iter 8.08867601860652 ns/iter 1.00
Regex_Caret_Period_Range_Dollar 4.665831623094242 ns/iter 4.68489834175964 ns/iter 1.00
Regex_Nested_Backtrack 818.4269600015867 ns/iter 823.6360329232282 ns/iter 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (macos/gcc)

Benchmark suite Current: 2492e5e Previous: d1039b8 Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.026600767951069 ns/iter 2.4195720697651444 ns/iter 0.84
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.079071925094296 ns/iter 2.3174542852993736 ns/iter 0.90
Regex_Period_Asterisk 2.009437282351249 ns/iter 2.34573295774675 ns/iter 0.86
Regex_Group_Period_Asterisk_Group 1.9704979943229592 ns/iter 2.392394755450172 ns/iter 0.82
Regex_Period_Plus 1.9963061784457965 ns/iter 1.9970364152816449 ns/iter 1.00
Regex_Period 2.0208231926398756 ns/iter 2.0219891210105225 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 2.055018419848769 ns/iter 1.9939159830868136 ns/iter 1.03
Regex_Caret_Group_Period_Plus_Group_Dollar 2.0435971677945113 ns/iter 2.1077153542634384 ns/iter 0.97
Regex_Caret_Period_Asterisk_Dollar 2.0052680676414862 ns/iter 2.353490441479331 ns/iter 0.85
Regex_Caret_Group_Period_Asterisk_Group_Dollar 2.3539794063396373 ns/iter 2.682683548533442 ns/iter 0.88
Regex_Caret_X_Hyphen 6.434392888215279 ns/iter 6.906095276325223 ns/iter 0.93
Regex_Period_Md_Dollar 74.8030893008348 ns/iter 73.29214143605276 ns/iter 1.02
Regex_Caret_Slash_Period_Asterisk 4.669338381029344 ns/iter 5.11486335625981 ns/iter 0.91
Regex_Caret_Period_Range_Dollar 2.077835856775558 ns/iter 2.3275476075501382 ns/iter 0.89
Regex_Nested_Backtrack 880.0238996168044 ns/iter 867.4661879869855 ns/iter 1.01
JSON_Array_Of_Objects_Unique 237.0036123475368 ns/iter 213.24683500663022 ns/iter 1.11
JSON_Parse_1 25509.622509919067 ns/iter 24996.58601164034 ns/iter 1.02
JSON_Fast_Hash_Helm_Chart_Lock 26.654392013281743 ns/iter 25.106959900570214 ns/iter 1.06
JSON_Equality_Helm_Chart_Lock 124.7035009488768 ns/iter 121.97786776868148 ns/iter 1.02
JSON_String_Equal/10 6.135770671134114 ns/iter 5.758435847668455 ns/iter 1.07
JSON_String_Equal/100 5.548843530010463 ns/iter 5.486693152532578 ns/iter 1.01
JSON_String_Equal_Small_By_Perfect_Hash/10 0.8206788841898318 ns/iter 0.797841942657607 ns/iter 1.03
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 3.7865099879272117 ns/iter 3.7041075376409105 ns/iter 1.02
JSON_String_Fast_Hash/10 2.046332388426806 ns/iter 2.0221980617441124 ns/iter 1.01
JSON_String_Fast_Hash/100 2.0703781023923953 ns/iter 2.023561221865578 ns/iter 1.02
JSON_String_Key_Hash/10 1.57251345832712 ns/iter 1.5005616754259958 ns/iter 1.05
JSON_String_Key_Hash/100 2.121870257146912 ns/iter 2.069351140277079 ns/iter 1.03
JSON_Object_Defines_Miss_Same_Length 1.8715366193755891 ns/iter 1.8334778564425385 ns/iter 1.02
JSON_Object_Defines_Miss_Too_Small 2.101276302125172 ns/iter 2.0728651951016746 ns/iter 1.01
JSON_Object_Defines_Miss_Too_Large 2.0327701402503022 ns/iter 1.876194814754322 ns/iter 1.08
Pointer_Object_Traverse 60.30684480203827 ns/iter 59.14382191972436 ns/iter 1.02
Pointer_Object_Try_Traverse 37.79610067356233 ns/iter 38.44343493689406 ns/iter 0.98
Pointer_Push_Back_Pointer_To_Weak_Pointer 189.26061572963368 ns/iter 186.46083669995804 ns/iter 1.02

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.