Skip to content

Commit

Permalink
Revise JSON public interface (#1497)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Jan 28, 2025
1 parent 32f08ad commit 11a33a9
Show file tree
Hide file tree
Showing 135 changed files with 2,821 additions and 2,713 deletions.
28 changes: 17 additions & 11 deletions benchmark/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

static void JSON_Array_Of_Objects_Unique(benchmark::State &state) {
// From Unreal Engine `uproject` files
const auto document{sourcemeta::core::parse(R"JSON([
const auto document{sourcemeta::core::parse_json(R"JSON([
{ "Enabled": true, "Name": "DDTools" },
{ "Enabled": true, "Name": "VideoCore" },
{ "Enabled": true, "Name": "EditorScriptingUtilities" },
Expand Down Expand Up @@ -86,15 +86,15 @@ static void JSON_Parse_1(benchmark::State &state) {
})JSON"};

for (auto _ : state) {
auto result{sourcemeta::core::parse(document)};
auto result{sourcemeta::core::parse_json(document)};
assert(result.is_object());
benchmark::DoNotOptimize(result);
}
}

static void JSON_Fast_Hash_Helm_Chart_Lock(benchmark::State &state) {
// From `helm-chart-lock`
const auto document{sourcemeta::core::parse(R"JSON({
const auto document{sourcemeta::core::parse_json(R"JSON({
"digest": "sha256:157d6244f0fac36b70be1aecfed8811037504d4e3a1060f50688e93531174040",
"generated": "2021-12-23T14:00:42.29198548Z",
"dependencies": [
Expand Down Expand Up @@ -130,7 +130,7 @@ static void JSON_Fast_Hash_Helm_Chart_Lock(benchmark::State &state) {
static void JSON_Equality_Helm_Chart_Lock(benchmark::State &state) {
// From `helm-chart-lock`

const auto document_1{sourcemeta::core::parse(R"JSON({
const auto document_1{sourcemeta::core::parse_json(R"JSON({
"digest": "sha256:157d6244f0fac36b70be1aecfed8811037504d4e3a1060f50688e93531174040",
"generated": "2021-12-23T14:00:42.29198548Z",
"dependencies": [
Expand All @@ -157,7 +157,7 @@ static void JSON_Equality_Helm_Chart_Lock(benchmark::State &state) {
]
})JSON")};

const auto document_2{sourcemeta::core::parse(R"JSON({
const auto document_2{sourcemeta::core::parse_json(R"JSON({
"digest": "sha256:157d6244f0fac36b70be1aecfed8811037504d4e3a1060f50688e93531174040",
"generated": "2021-12-23T14:00:42.29198548Z",
"dependencies": [
Expand Down Expand Up @@ -208,7 +208,8 @@ static void JSON_String_Equal_Small_By_Perfect_Hash(benchmark::State &state) {
const auto length{static_cast<std::size_t>(state.range(0))};
sourcemeta::core::JSON::String left(length, 'x');
sourcemeta::core::JSON::String right(length, 'x');
const sourcemeta::core::KeyHash<sourcemeta::core::JSON::String> hasher;
const sourcemeta::core::PropertyHashJSON<sourcemeta::core::JSON::String>
hasher;
const auto hash_left{hasher(left)};
const auto hash_right{hasher(right)};
assert(hasher.is_perfect(hash_left));
Expand All @@ -225,7 +226,8 @@ JSON_String_Equal_Small_By_Runtime_Perfect_Hash(benchmark::State &state) {
const auto length{static_cast<std::size_t>(state.range(0))};
sourcemeta::core::JSON::String left(length, 'x');
sourcemeta::core::JSON::String right(length, 'x');
const sourcemeta::core::KeyHash<sourcemeta::core::JSON::String> hasher;
const sourcemeta::core::PropertyHashJSON<sourcemeta::core::JSON::String>
hasher;
for (auto _ : state) {
const auto hash_left{hasher(left)};
const auto hash_right{hasher(right)};
Expand All @@ -249,7 +251,8 @@ static void JSON_String_Fast_Hash(benchmark::State &state) {
static void JSON_String_Key_Hash(benchmark::State &state) {
const auto length{static_cast<std::size_t>(state.range(0))};
sourcemeta::core::JSON::String value(length, 'x');
const sourcemeta::core::KeyHash<sourcemeta::core::JSON::String> hasher;
const sourcemeta::core::PropertyHashJSON<sourcemeta::core::JSON::String>
hasher;
for (auto _ : state) {
benchmark::DoNotOptimize(hasher(value));
}
Expand All @@ -260,7 +263,8 @@ static void JSON_Object_Defines_Miss_Same_Length(benchmark::State &state) {
document.assign("abcdefg", sourcemeta::core::JSON{1});
document.assign("abcdefgh", sourcemeta::core::JSON{2});
document.assign("abcdefghi", sourcemeta::core::JSON{3});
const sourcemeta::core::KeyHash<sourcemeta::core::JSON::String> hasher;
const sourcemeta::core::PropertyHashJSON<sourcemeta::core::JSON::String>
hasher;
const auto &object{document.as_object()};
const sourcemeta::core::JSON::String key{"foobarbaz"};
const auto key_hash{hasher(key)};
Expand All @@ -276,7 +280,8 @@ static void JSON_Object_Defines_Miss_Too_Small(benchmark::State &state) {
document.assign("abcdefg", sourcemeta::core::JSON{1});
document.assign("abcdefgh", sourcemeta::core::JSON{2});
document.assign("abcdefghi", sourcemeta::core::JSON{3});
const sourcemeta::core::KeyHash<sourcemeta::core::JSON::String> hasher;
const sourcemeta::core::PropertyHashJSON<sourcemeta::core::JSON::String>
hasher;
const auto &object{document.as_object()};
const sourcemeta::core::JSON::String key{"foo"};
const auto key_hash{hasher(key)};
Expand All @@ -292,7 +297,8 @@ static void JSON_Object_Defines_Miss_Too_Large(benchmark::State &state) {
document.assign("abcdefg", sourcemeta::core::JSON{1});
document.assign("abcdefgh", sourcemeta::core::JSON{2});
document.assign("abcdefghi", sourcemeta::core::JSON{3});
const sourcemeta::core::KeyHash<sourcemeta::core::JSON::String> hasher;
const sourcemeta::core::PropertyHashJSON<sourcemeta::core::JSON::String>
hasher;
const auto &object{document.as_object()};
const sourcemeta::core::JSON::String key{"toolargestring"};
const auto key_hash{hasher(key)};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/jsonpointer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <sourcemeta/core/jsonpointer.h>

static void Pointer_Object_Traverse(benchmark::State &state) {
const auto document{sourcemeta::core::parse(R"JSON({
const auto document{sourcemeta::core::parse_json(R"JSON({
"one": {
"two": {
"three": {
Expand Down Expand Up @@ -41,7 +41,7 @@ static void Pointer_Object_Traverse(benchmark::State &state) {
}

static void Pointer_Object_Try_Traverse(benchmark::State &state) {
const auto document{sourcemeta::core::parse(R"JSON({
const auto document{sourcemeta::core::parse_json(R"JSON({
"one": {
"two": {
"three": {
Expand Down
87 changes: 33 additions & 54 deletions src/core/json/include/sourcemeta/core/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <cstdint> // std::uint64_t
#include <filesystem> // std::filesystem
#include <fstream> // std::basic_ifstream
#include <functional> // std::function
#include <istream> // std::basic_istream
#include <ostream> // std::basic_ostream
#include <string> // std::basic_string
Expand All @@ -29,22 +28,6 @@

namespace sourcemeta::core {

/// @ingroup json
using Hash = FastHash<JSON>;

/// @ingroup json
enum class CallbackPhase { Pre, Post };

/// @ingroup json
///
/// An optional callback that can be passed to parsing functions to obtain
/// metadata during the parsing process. Each subdocument will emit 2 events: a
/// "pre" and a "post". When parsing object and arrays, during the "pre" event,
/// the value corresponds to the property name or index, respectively.
using Callback = std::function<void(
const CallbackPhase phase, const JSON::Type type, const std::uint64_t line,
const std::uint64_t column, const JSON &value)>;

/// @ingroup json
///
/// Create a JSON document from a C++ standard input stream. For example, a JSON
Expand All @@ -57,14 +40,14 @@ using Callback = std::function<void(
///
/// std::istringstream stream{"[ 1, 2, 3 ]"};
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse(stream);
/// sourcemeta::core::parse_json(stream);
/// assert(document.is_array());
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto parse(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
const Callback &callback = nullptr) -> JSON;
auto parse_json(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
const JSON::ParseCallback &callback = nullptr) -> JSON;

/// @ingroup json
///
Expand All @@ -76,14 +59,14 @@ auto parse(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
/// #include <cassert>
///
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse("[ 1, 2, 3 ]");
/// sourcemeta::core::parse_json("[ 1, 2, 3 ]");
/// assert(document.is_array());
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto parse(const std::basic_string<JSON::Char, JSON::CharTraits> &input,
const Callback &callback = nullptr) -> JSON;
auto parse_json(const std::basic_string<JSON::Char, JSON::CharTraits> &input,
const JSON::ParseCallback &callback = nullptr) -> JSON;

/// @ingroup json
///
Expand All @@ -99,13 +82,13 @@ auto parse(const std::basic_string<JSON::Char, JSON::CharTraits> &input,
/// std::uint64_t line{1};
/// std::uint64_t column{0};
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse(stream, line, column);
/// sourcemeta::core::parse_json(stream, line, column);
/// assert(document.is_array());
/// ```
SOURCEMETA_CORE_JSON_EXPORT
auto parse(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
std::uint64_t &line, std::uint64_t &column,
const Callback &callback = nullptr) -> JSON;
auto parse_json(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
std::uint64_t &line, std::uint64_t &column,
const JSON::ParseCallback &callback = nullptr) -> JSON;

/// @ingroup json
///
Expand All @@ -119,52 +102,55 @@ auto parse(std::basic_istream<JSON::Char, JSON::CharTraits> &stream,
/// std::uint64_t line{1};
/// std::uint64_t column{0};
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse("[ 1, 2, 3 ]", line, column);
/// sourcemeta::core::parse_json("[ 1, 2, 3 ]", line, column);
/// assert(document.is_array());
/// ```
SOURCEMETA_CORE_JSON_EXPORT
auto parse(const std::basic_string<JSON::Char, JSON::CharTraits> &input,
std::uint64_t &line, std::uint64_t &column,
const Callback &callback = nullptr) -> JSON;
auto parse_json(const std::basic_string<JSON::Char, JSON::CharTraits> &input,
std::uint64_t &line, std::uint64_t &column,
const JSON::ParseCallback &callback = nullptr) -> JSON;

/// @ingroup json
///
/// A convenience function to read a document from a file. For example:
/// A convenience function to create a JSON document from a file. For example:
///
/// ```cpp
/// #include <sourcemeta/core/json.h>
/// #include <cassert>
/// #include <iostream>
///
/// auto stream = sourcemeta::core::read_file("/tmp/foo.json");
/// const auto document = sourcemeta::core::parse(stream);
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::read_json("/tmp/foo.json");
/// sourcemeta::core::stringify(document, std::cout);
/// std::cout << std::endl;
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto read_file(const std::filesystem::path &path)
-> std::basic_ifstream<JSON::Char, JSON::CharTraits>;
auto read_json(const std::filesystem::path &path) -> JSON;

// TODO: Move this function to a system integration component, as it
// is not JSON specific

/// @ingroup json
///
/// A convenience function to create a JSON document from a file. For example:
/// A convenience function to read a document from a file. For example:
///
/// ```cpp
/// #include <sourcemeta/core/json.h>
/// #include <cassert>
/// #include <iostream>
///
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::from_file("/tmp/foo.json");
/// auto stream = sourcemeta::core::read_file("/tmp/foo.json");
/// const auto document = sourcemeta::core::parse_json(stream);
/// sourcemeta::core::stringify(document, std::cout);
/// std::cout << std::endl;
/// ```
///
/// If parsing fails, sourcemeta::core::ParseError will be thrown.
SOURCEMETA_CORE_JSON_EXPORT
auto from_file(const std::filesystem::path &path) -> JSON;
auto read_file(const std::filesystem::path &path)
-> std::basic_ifstream<JSON::Char, JSON::CharTraits>;

/// @ingroup json
///
Expand All @@ -177,7 +163,7 @@ auto from_file(const std::filesystem::path &path) -> JSON;
/// #include <sstream>
///
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse("[ 1, 2, 3 ]");
/// sourcemeta::core::parse_json("[ 1, 2, 3 ]");
/// std::ostringstream stream;
/// sourcemeta::core::stringify(document, stream);
/// std::cout << stream.str() << std::endl;
Expand All @@ -198,7 +184,7 @@ auto stringify(const JSON &document,
/// #include <sstream>
///
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse("[ 1, 2, 3 ]");
/// sourcemeta::core::parse_json("[ 1, 2, 3 ]");
/// std::ostringstream stream;
/// sourcemeta::core::prettify(document, stream);
/// std::cout << stream.str() << std::endl;
Expand All @@ -207,13 +193,6 @@ SOURCEMETA_CORE_JSON_EXPORT
auto prettify(const JSON &document,
std::basic_ostream<JSON::Char, JSON::CharTraits> &stream) -> void;

/// @ingroup json
///
/// A comparison function between object property keys.
/// See https://en.cppreference.com/w/cpp/named_req/Compare
using KeyComparison =
std::function<bool(const JSON::String &, const JSON::String &)>;

/// @ingroup json
///
/// Stringify the input JSON document into a given C++ standard output stream in
Expand All @@ -231,15 +210,15 @@ using KeyComparison =
/// }
///
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse("{ \"foo\": 1, \"bar\": 2, \"baz\": 3 }");
/// sourcemeta::core::parse_json("{ \"foo\": 1, \"bar\": 2, \"baz\": 3 }");
/// std::ostringstream stream;
/// sourcemeta::core::stringify(document, stream, key_compare);
/// std::cout << stream.str() << std::endl;
/// ```
SOURCEMETA_CORE_JSON_EXPORT
auto stringify(const JSON &document,
std::basic_ostream<JSON::Char, JSON::CharTraits> &stream,
const KeyComparison &compare) -> void;
const JSON::KeyComparison &compare) -> void;

/// @ingroup json
///
Expand All @@ -259,15 +238,15 @@ auto stringify(const JSON &document,
/// }
///
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse("{ \"foo\": 1, \"bar\": 2, \"baz\": 3 }");
/// sourcemeta::core::parse_json("{ \"foo\": 1, \"bar\": 2, \"baz\": 3 }");
/// std::ostringstream stream;
/// sourcemeta::core::prettify(document, stream, key_compare);
/// std::cout << stream.str() << std::endl;
/// ```
SOURCEMETA_CORE_JSON_EXPORT
auto prettify(const JSON &document,
std::basic_ostream<JSON::Char, JSON::CharTraits> &stream,
const KeyComparison &compare) -> void;
const JSON::KeyComparison &compare) -> void;

/// @ingroup json
///
Expand All @@ -281,7 +260,7 @@ auto prettify(const JSON &document,
/// #include <sstream>
///
/// const sourcemeta::core::JSON document =
/// sourcemeta::core::parse("[ 1, 2, 3 ]");
/// sourcemeta::core::parse_json("[ 1, 2, 3 ]");
/// std::ostringstream stream;
/// stream << document;
/// std::cout << stream.str() << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions src/core/json/include/sourcemeta/core/json_hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace sourcemeta::core {

/// @ingroup json
template <typename T> struct FastHash {
template <typename T> struct HashJSON {
using hash_type = std::uint64_t;
inline auto operator()(const T &value) const noexcept -> hash_type {
return value.fast_hash();
Expand All @@ -20,7 +20,7 @@ template <typename T> struct FastHash {
};

/// @ingroup json
template <typename T> struct KeyHash {
template <typename T> struct PropertyHashJSON {
struct hash_type {
// For performance when the platform allows it
#if defined(__SIZEOF_INT128__)
Expand Down
8 changes: 7 additions & 1 deletion src/core/json/include/sourcemeta/core/json_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ template <typename Key, typename Value, typename Hash> class FlatMap {
return true;
}

Hash hasher;

private:
underlying_type data;
Hash hasher;
};

/// @ingroup json
Expand Down Expand Up @@ -398,6 +399,11 @@ template <typename Key, typename Value, typename Hash> class JSONObject {
return this->data.at(index);
}

// Hash an object property
inline auto hash(const Key &property) const -> Container::hash_type {
return this->data.hasher(property);
}

private:
friend Value;
// Exporting symbols that depends on the standard C++ library is considered
Expand Down
Loading

5 comments on commit 11a33a9

@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: 11a33a9 Previous: 32f08ad Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.2807808245183803 ns/iter 2.2050512387874956 ns/iter 1.03
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.221557165399618 ns/iter 2.2133154306637066 ns/iter 1.00
Regex_Period_Asterisk 2.2191893553347626 ns/iter 2.2012901741780393 ns/iter 1.01
Regex_Group_Period_Asterisk_Group 2.1994656302916735 ns/iter 2.207811657735912 ns/iter 1.00
Regex_Period_Plus 2.7987753106338396 ns/iter 2.7985361671290168 ns/iter 1.00
Regex_Period 2.798308478299979 ns/iter 2.796764586974133 ns/iter 1.00
Regex_Caret_Period_Plus_Dollar 2.7982167929019197 ns/iter 2.5723747925543075 ns/iter 1.09
Regex_Caret_Group_Period_Plus_Group_Dollar 2.8002324135062695 ns/iter 2.7981650539947505 ns/iter 1.00
Regex_Caret_Period_Asterisk_Dollar 3.419790248577038 ns/iter 3.4193891778202787 ns/iter 1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar 3.4193372720644657 ns/iter 3.4197174739966787 ns/iter 1.00
Regex_Caret_X_Hyphen 13.068842961291075 ns/iter 13.072647488173848 ns/iter 1.00
Regex_Period_Md_Dollar 81.57622794228904 ns/iter 81.42181245940239 ns/iter 1.00
Regex_Caret_Slash_Period_Asterisk 6.906041716414757 ns/iter 6.842858695849204 ns/iter 1.01
Regex_Caret_Period_Range_Dollar 3.1988594614279253 ns/iter 4.0487327974963225 ns/iter 0.79
Regex_Nested_Backtrack 498.8224675494191 ns/iter 494.07905326505045 ns/iter 1.01
JSON_Array_Of_Objects_Unique 393.77675461475536 ns/iter 411.7208253809518 ns/iter 0.96
JSON_Parse_1 30342.110026772396 ns/iter 30431.233809193825 ns/iter 1.00
JSON_Fast_Hash_Helm_Chart_Lock 59.349495702311664 ns/iter 58.451094197492765 ns/iter 1.02
JSON_Equality_Helm_Chart_Lock 160.6295372889585 ns/iter 149.40573471663004 ns/iter 1.08
JSON_String_Equal/10 6.1222407548890345 ns/iter 6.226806037500554 ns/iter 0.98
JSON_String_Equal/100 6.528766554882213 ns/iter 6.849685508971541 ns/iter 0.95
JSON_String_Equal_Small_By_Perfect_Hash/10 0.9341422097778194 ns/iter 0.9349340346684696 ns/iter 1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 10.810776138935813 ns/iter 14.634331506503015 ns/iter 0.74
JSON_String_Fast_Hash/10 2.4868043705189415 ns/iter 2.486387677696929 ns/iter 1.00
JSON_String_Fast_Hash/100 2.4851975770456836 ns/iter 2.4886060061438067 ns/iter 1.00
JSON_String_Key_Hash/10 2.1773075927702035 ns/iter 2.676963179512288 ns/iter 0.81
JSON_String_Key_Hash/100 1.866522211366547 ns/iter 1.881861828928084 ns/iter 0.99
JSON_Object_Defines_Miss_Same_Length 3.73248016178213 ns/iter 3.732354810678442 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Small 3.73470404911357 ns/iter 3.7327104571903975 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Large 3.732980224981921 ns/iter 3.7370353683927093 ns/iter 1.00
Pointer_Object_Traverse 44.47817152719941 ns/iter 44.22833468570419 ns/iter 1.01
Pointer_Object_Try_Traverse 52.40706450334246 ns/iter 52.304825167989144 ns/iter 1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer 301.8532897197501 ns/iter 308.0664655172357 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 (macos/llvm)

Benchmark suite Current: 11a33a9 Previous: 32f08ad Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.116681058480461 ns/iter 1.6827194789176951 ns/iter 1.26
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 1.7736099918214527 ns/iter 1.7303372628161136 ns/iter 1.03
Regex_Period_Asterisk 1.7444086660931577 ns/iter 1.6979457280891974 ns/iter 1.03
Regex_Group_Period_Asterisk_Group 1.8582800667293007 ns/iter 1.719293095624922 ns/iter 1.08
Regex_Period_Plus 2.5604757934042426 ns/iter 2.6205341010478436 ns/iter 0.98
Regex_Period 2.38863893790297 ns/iter 2.0408653404165085 ns/iter 1.17
Regex_Caret_Period_Plus_Dollar 2.1412191002759196 ns/iter 2.0543954113417757 ns/iter 1.04
Regex_Caret_Group_Period_Plus_Group_Dollar 2.031754372466838 ns/iter 2.097602018542431 ns/iter 0.97
Regex_Caret_Period_Asterisk_Dollar 1.7061892441467585 ns/iter 1.7439165049669223 ns/iter 0.98
Regex_Caret_Group_Period_Asterisk_Group_Dollar 1.699064495733761 ns/iter 1.717822964164223 ns/iter 0.99
Regex_Caret_X_Hyphen 7.220669999246519 ns/iter 7.147051527943531 ns/iter 1.01
Regex_Period_Md_Dollar 74.59936204315419 ns/iter 73.07643442975136 ns/iter 1.02
Regex_Caret_Slash_Period_Asterisk 5.5818021686504276 ns/iter 5.3954649742540095 ns/iter 1.03
Regex_Caret_Period_Range_Dollar 2.4039329240168885 ns/iter 2.4011941881299848 ns/iter 1.00
Regex_Nested_Backtrack 794.018258601869 ns/iter 784.5882081943905 ns/iter 1.01
JSON_Array_Of_Objects_Unique 364.73191988073086 ns/iter 379.6569806467342 ns/iter 0.96
JSON_Parse_1 23444.95783667393 ns/iter 35183.86221112478 ns/iter 0.67
JSON_Fast_Hash_Helm_Chart_Lock 54.31572214370856 ns/iter 62.02613171375173 ns/iter 0.88
JSON_Equality_Helm_Chart_Lock 135.93192103175582 ns/iter 134.87852202551315 ns/iter 1.01
JSON_String_Equal/10 8.25028442961671 ns/iter 12.404813837431663 ns/iter 0.67
JSON_String_Equal/100 6.712316225727439 ns/iter 10.625019157009811 ns/iter 0.63
JSON_String_Equal_Small_By_Perfect_Hash/10 0.3413935109351046 ns/iter 0.43332202807624554 ns/iter 0.79
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 3.1936554959815058 ns/iter 3.473855823508688 ns/iter 0.92
JSON_String_Fast_Hash/10 1.7899087917700789 ns/iter 1.928244372652104 ns/iter 0.93
JSON_String_Fast_Hash/100 2.0813058370555684 ns/iter 2.3916853368727824 ns/iter 0.87
JSON_String_Key_Hash/10 1.3658070510356177 ns/iter 1.6065193911743492 ns/iter 0.85
JSON_String_Key_Hash/100 1.3676967869786802 ns/iter 1.6382410334190993 ns/iter 0.83
JSON_Object_Defines_Miss_Same_Length 2.379236223483284 ns/iter 2.925572186595005 ns/iter 0.81
JSON_Object_Defines_Miss_Too_Small 2.3779830499208705 ns/iter 2.718249649963116 ns/iter 0.87
JSON_Object_Defines_Miss_Too_Large 2.3685362230764113 ns/iter 2.5559707004344143 ns/iter 0.93
Pointer_Object_Traverse 18.26172252115055 ns/iter 17.134323446935063 ns/iter 1.07
Pointer_Object_Try_Traverse 23.68588144455477 ns/iter 24.383149683893286 ns/iter 0.97
Pointer_Push_Back_Pointer_To_Weak_Pointer 180.05261467732967 ns/iter 197.63646902990922 ns/iter 0.91

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: 11a33a9 Previous: 32f08ad Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 6.844563616071094 ns/iter 7.147975446428438 ns/iter 0.96
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 6.970795758926482 ns/iter 7.502809787934586 ns/iter 0.93
Regex_Period_Asterisk 6.900215401784188 ns/iter 7.227042824878567 ns/iter 0.95
Regex_Group_Period_Asterisk_Group 6.878539062500672 ns/iter 7.08246093749944 ns/iter 0.97
Regex_Period_Plus 7.456861607142429 ns/iter 7.67855580357159 ns/iter 0.97
Regex_Period 7.3951149553559095 ns/iter 7.46789460951887 ns/iter 0.99
Regex_Caret_Period_Plus_Dollar 7.171933035713554 ns/iter 7.425104910714354 ns/iter 0.97
Regex_Caret_Group_Period_Plus_Group_Dollar 7.305022321428823 ns/iter 7.226074776784941 ns/iter 1.01
Regex_Caret_Period_Asterisk_Dollar 7.04188657570672 ns/iter 6.864740594353845 ns/iter 1.03
Regex_Caret_Group_Period_Asterisk_Group_Dollar 6.845764508927996 ns/iter 6.991833705357767 ns/iter 0.98
Regex_Caret_X_Hyphen 14.254191900652053 ns/iter 11.850531249999463 ns/iter 1.20
Regex_Period_Md_Dollar 151.10101334369136 ns/iter 148.24158489991353 ns/iter 1.02
Regex_Caret_Slash_Period_Asterisk 10.584266071426946 ns/iter 10.644928571429498 ns/iter 0.99
Regex_Caret_Period_Range_Dollar 7.53312611607017 ns/iter 7.860719866071366 ns/iter 0.96
Regex_Nested_Backtrack 606.4551000001757 ns/iter 638.666428571355 ns/iter 0.95
JSON_Array_Of_Objects_Unique 497.2141999999167 ns/iter 455.02657901079345 ns/iter 1.09
JSON_Parse_1 81026.23883927049 ns/iter 80027.64162314251 ns/iter 1.01
JSON_Fast_Hash_Helm_Chart_Lock 66.83645535714179 ns/iter 69.87543526784735 ns/iter 0.96
JSON_Equality_Helm_Chart_Lock 187.5144542423164 ns/iter 195.41790645457885 ns/iter 0.96
JSON_String_Equal/10 10.097710937500892 ns/iter 9.721643749999842 ns/iter 1.04
JSON_String_Equal/100 9.93522049136069 ns/iter 9.979635937499507 ns/iter 1.00
JSON_String_Equal_Small_By_Perfect_Hash/10 2.171586875000031 ns/iter 2.166455937500089 ns/iter 1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 15.126024553571783 ns/iter 14.709906250001126 ns/iter 1.03
JSON_String_Fast_Hash/10 4.032457819700725 ns/iter 3.7215407076398486 ns/iter 1.08
JSON_String_Fast_Hash/100 4.034441406249708 ns/iter 3.7134037433689278 ns/iter 1.09
JSON_String_Key_Hash/10 7.8205191615166605 ns/iter 7.503493303570506 ns/iter 1.04
JSON_String_Key_Hash/100 4.026358846474913 ns/iter 4.024878906249617 ns/iter 1.00
JSON_Object_Defines_Miss_Same_Length 3.7171205290754754 ns/iter 3.719395171929634 ns/iter 1.00
JSON_Object_Defines_Miss_Too_Small 4.948376785715628 ns/iter 3.7128219576558097 ns/iter 1.33
JSON_Object_Defines_Miss_Too_Large 3.410099067828573 ns/iter 4.961512499999036 ns/iter 0.69
Pointer_Object_Traverse 80.14955357142283 ns/iter 53.2645267857187 ns/iter 1.50
Pointer_Object_Try_Traverse 116.66635937501722 ns/iter 67.91901785713809 ns/iter 1.72
Pointer_Push_Back_Pointer_To_Weak_Pointer 160.55787946430857 ns/iter 185.73593622640337 ns/iter 0.86

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: 11a33a9 Previous: 32f08ad Ratio
Pointer_Object_Traverse 45.16390949323974 ns/iter 54.34749509404063 ns/iter 0.83
Pointer_Object_Try_Traverse 26.111382534973224 ns/iter 28.983666244883143 ns/iter 0.90
Pointer_Push_Back_Pointer_To_Weak_Pointer 144.9049279761811 ns/iter 154.076501832303 ns/iter 0.94
JSON_Array_Of_Objects_Unique 432.3543943975185 ns/iter 442.5835886261339 ns/iter 0.98
JSON_Parse_1 33451.40408398043 ns/iter 36112.565675629994 ns/iter 0.93
JSON_Fast_Hash_Helm_Chart_Lock 62.56616092964772 ns/iter 73.8561006466179 ns/iter 0.85
JSON_Equality_Helm_Chart_Lock 150.14916566167022 ns/iter 152.9936441745487 ns/iter 0.98
JSON_String_Equal/10 6.030313865090898 ns/iter 6.395072807502929 ns/iter 0.94
JSON_String_Equal/100 6.657679394850591 ns/iter 7.0058745913644715 ns/iter 0.95
JSON_String_Equal_Small_By_Perfect_Hash/10 0.934618627759943 ns/iter 0.6594379767577471 ns/iter 1.42
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 14.288583883154198 ns/iter 15.216440897870488 ns/iter 0.94
JSON_String_Fast_Hash/10 0.9327954438653635 ns/iter 1.008320928849041 ns/iter 0.93
JSON_String_Fast_Hash/100 0.9398972460159669 ns/iter 1.0031880991937727 ns/iter 0.94
JSON_String_Key_Hash/10 1.6764196359396297 ns/iter 1.8199935868715253 ns/iter 0.92
JSON_String_Key_Hash/100 1.9901229535658163 ns/iter 2.1813446860624146 ns/iter 0.91
JSON_Object_Defines_Miss_Same_Length 2.5086782802576244 ns/iter 3.3377526112056084 ns/iter 0.75
JSON_Object_Defines_Miss_Too_Small 2.4894920870454817 ns/iter 2.9942160340396624 ns/iter 0.83
JSON_Object_Defines_Miss_Too_Large 3.108352550658352 ns/iter 2.6439884647410943 ns/iter 1.18
Regex_Lower_S_Or_Upper_S_Asterisk 3.4227076820488813 ns/iter 3.059171091366654 ns/iter 1.12
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 3.420816557939057 ns/iter 3.023870882684113 ns/iter 1.13
Regex_Period_Asterisk 3.424576616171009 ns/iter 3.0066731142515315 ns/iter 1.14
Regex_Group_Period_Asterisk_Group 3.420972487445795 ns/iter 3.0254330819692563 ns/iter 1.13
Regex_Period_Plus 3.733946174448897 ns/iter 3.705628640089904 ns/iter 1.01
Regex_Period 3.7409591857185673 ns/iter 3.341474013853179 ns/iter 1.12
Regex_Caret_Period_Plus_Dollar 3.7308946651251813 ns/iter 3.327684905453914 ns/iter 1.12
Regex_Caret_Group_Period_Plus_Group_Dollar 3.7322776100461215 ns/iter 3.310499342131012 ns/iter 1.13
Regex_Caret_Period_Asterisk_Dollar 4.664733973566954 ns/iter 3.3089294795128765 ns/iter 1.41
Regex_Caret_Group_Period_Asterisk_Group_Dollar 4.666126075688497 ns/iter 3.3346111597559487 ns/iter 1.40
Regex_Caret_X_Hyphen 12.4313248757565 ns/iter 13.23425534471811 ns/iter 0.94
Regex_Period_Md_Dollar 89.85685949284017 ns/iter 99.91438374615716 ns/iter 0.90
Regex_Caret_Slash_Period_Asterisk 8.080048423392693 ns/iter 7.910727968161967 ns/iter 1.02
Regex_Caret_Period_Range_Dollar 4.663130342025331 ns/iter 4.684097184433108 ns/iter 1.00
Regex_Nested_Backtrack 940.5691427652416 ns/iter 944.3808752434552 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 (macos/gcc)

Benchmark suite Current: 11a33a9 Previous: 32f08ad Ratio
Regex_Lower_S_Or_Upper_S_Asterisk 2.196760277209099 ns/iter 2.2832958426894554 ns/iter 0.96
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar 2.2322388629451297 ns/iter 2.2327621949887217 ns/iter 1.00
Regex_Period_Asterisk 2.3215049687761944 ns/iter 2.5522930690091035 ns/iter 0.91
Regex_Group_Period_Asterisk_Group 2.3500710499001016 ns/iter 2.3870303051087363 ns/iter 0.98
Regex_Period_Plus 2.0218266456797207 ns/iter 1.8560831524774686 ns/iter 1.09
Regex_Period 2.1037899700310523 ns/iter 1.8317757687395426 ns/iter 1.15
Regex_Caret_Period_Plus_Dollar 2.0174590362279674 ns/iter 2.2296130586190483 ns/iter 0.90
Regex_Caret_Group_Period_Plus_Group_Dollar 2.0201504749374 ns/iter 1.8695473004260552 ns/iter 1.08
Regex_Caret_Period_Asterisk_Dollar 2.323303586173808 ns/iter 2.220666649089393 ns/iter 1.05
Regex_Caret_Group_Period_Asterisk_Group_Dollar 2.643869943396479 ns/iter 2.4684305859070435 ns/iter 1.07
Regex_Caret_X_Hyphen 6.876340459185298 ns/iter 7.44995902098891 ns/iter 0.92
Regex_Period_Md_Dollar 74.9346184043941 ns/iter 79.67971547930026 ns/iter 0.94
Regex_Caret_Slash_Period_Asterisk 5.138597757528322 ns/iter 4.9396724039931605 ns/iter 1.04
Regex_Caret_Period_Range_Dollar 2.533402868271604 ns/iter 2.5088013315851443 ns/iter 1.01
Regex_Nested_Backtrack 912.6251609121055 ns/iter 989.2720892096952 ns/iter 0.92
JSON_Array_Of_Objects_Unique 220.5396592765276 ns/iter 234.93904460842936 ns/iter 0.94
JSON_Parse_1 29117.145683620212 ns/iter 25662.577647870687 ns/iter 1.13
JSON_Fast_Hash_Helm_Chart_Lock 26.933432085760153 ns/iter 26.327074243768735 ns/iter 1.02
JSON_Equality_Helm_Chart_Lock 126.15392027961005 ns/iter 136.4379546677491 ns/iter 0.92
JSON_String_Equal/10 6.533409925520619 ns/iter 6.591113439334022 ns/iter 0.99
JSON_String_Equal/100 5.4464437338623455 ns/iter 5.615534496315439 ns/iter 0.97
JSON_String_Equal_Small_By_Perfect_Hash/10 0.8209938713791164 ns/iter 1.042296088572728 ns/iter 0.79
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10 3.713139426758567 ns/iter 3.8584516407740805 ns/iter 0.96
JSON_String_Fast_Hash/10 2.079401748237526 ns/iter 2.061697893151242 ns/iter 1.01
JSON_String_Fast_Hash/100 2.0781193187743954 ns/iter 2.081081571929755 ns/iter 1.00
JSON_String_Key_Hash/10 1.5504810253478103 ns/iter 1.6007584462672948 ns/iter 0.97
JSON_String_Key_Hash/100 2.069647201336622 ns/iter 2.120165809145354 ns/iter 0.98
JSON_Object_Defines_Miss_Same_Length 1.8472640281530048 ns/iter 1.924173899185013 ns/iter 0.96
JSON_Object_Defines_Miss_Too_Small 2.044030207526412 ns/iter 2.2394217449608966 ns/iter 0.91
JSON_Object_Defines_Miss_Too_Large 1.854803647292833 ns/iter 2.860982020577568 ns/iter 0.65
Pointer_Object_Traverse 58.92435510813561 ns/iter 71.47409823587779 ns/iter 0.82
Pointer_Object_Try_Traverse 38.5514895762365 ns/iter 53.72751278460807 ns/iter 0.72
Pointer_Push_Back_Pointer_To_Weak_Pointer 163.53684220010373 ns/iter 199.35333580423142 ns/iter 0.82

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

Please sign in to comment.