-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
TransformRule
in the JSON Schema module (#1482)
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
7 changed files
with
405 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
src/core/jsonschema/include/sourcemeta/jsontoolkit/jsonschema_transform.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_RULE_H_ | ||
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_RULE_H_ | ||
|
||
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT | ||
#include <sourcemeta/jsontoolkit/jsonschema_export.h> | ||
#endif | ||
|
||
#include <sourcemeta/jsontoolkit/json.h> | ||
#include <sourcemeta/jsontoolkit/jsonpointer.h> | ||
#include <sourcemeta/jsontoolkit/jsonschema_resolver.h> | ||
|
||
#include <optional> // std::optional, std::nullopt | ||
#include <set> // std::set | ||
#include <string> // std::string | ||
#include <vector> // std::vector | ||
|
||
namespace sourcemeta::jsontoolkit { | ||
/// @ingroup jsonschema | ||
/// | ||
/// A class that represents a transformation rule. Clients of this class | ||
/// are expected to subclass and implement their own condition and | ||
/// transformation methods. | ||
/// | ||
/// For example, this is a rule that deletes any property called `foo` in every | ||
/// subschema: | ||
/// | ||
/// ```cpp | ||
/// #include <sourcemeta/jsontoolkit/jsonschema.h> | ||
/// | ||
/// class MyTransformRule final | ||
/// : public sourcemeta::jsontoolkit::TransformRule { | ||
/// public: | ||
/// MyTransformRule() : sourcemeta::jsontoolkit::TransformRule("my_rule", "My | ||
/// rule") {}; | ||
/// | ||
/// [[nodiscard]] auto condition(const sourcemeta::jsontoolkit::JSON &schema, | ||
/// const std::string &dialect, | ||
/// const std::set<std::string> &vocabularies, | ||
/// const sourcemeta::jsontoolkit::Pointer | ||
/// &pointer) const | ||
/// -> bool override | ||
/// return schema.defines("foo"); | ||
/// } | ||
/// | ||
/// auto transform(sourcemeta::jsontoolkit::PointerProxy &transformer) | ||
/// const -> void override { | ||
/// transformer.erase("foo"); | ||
/// } | ||
/// }; | ||
/// ``` | ||
class SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT TransformRule { | ||
public: | ||
/// Create a transformation rule. Each rule must have a unique name. | ||
TransformRule(std::string &&name, std::string &&message); | ||
|
||
// Necessary to wrap rules on smart pointers | ||
virtual ~TransformRule() = default; | ||
|
||
// We don't need any of these | ||
TransformRule(const TransformRule &) = delete; | ||
TransformRule(TransformRule &&) = delete; | ||
auto operator=(const TransformRule &) -> TransformRule & = delete; | ||
auto operator=(TransformRule &&) -> TransformRule & = delete; | ||
|
||
/// Compare a rule against another rule. | ||
auto operator==(const TransformRule &other) const -> bool; | ||
|
||
/// Fetch the name of a rule | ||
[[nodiscard]] auto name() const -> const std::string &; | ||
|
||
/// Fetch the message of a rule | ||
[[nodiscard]] auto message() const -> const std::string &; | ||
|
||
/// Apply the rule to a schema | ||
auto | ||
apply(JSON &schema, const Pointer &pointer, const SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect = std::nullopt) const | ||
-> std::vector<PointerProxy::Operation>; | ||
|
||
/// Check if the rule applies to a schema | ||
auto | ||
check(const JSON &schema, const Pointer &pointer, | ||
const SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect = std::nullopt) const | ||
-> bool; | ||
|
||
private: | ||
/// The rule condition | ||
[[nodiscard]] virtual auto | ||
condition(const JSON &schema, const std::string &dialect, | ||
const std::set<std::string> &vocabularies, | ||
const Pointer &pointer) const -> bool = 0; | ||
|
||
/// The rule transformation | ||
virtual auto transform(PointerProxy &transformer) const -> void = 0; | ||
|
||
// Exporting symbols that depends on the standard C++ library is considered | ||
// safe. | ||
// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN | ||
#if defined(_MSC_VER) | ||
#pragma warning(disable : 4251) | ||
#endif | ||
const std::string name_; | ||
const std::string message_; | ||
#if defined(_MSC_VER) | ||
#pragma warning(default : 4251) | ||
#endif | ||
}; | ||
} // namespace sourcemeta::jsontoolkit | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#include <sourcemeta/jsontoolkit/jsonschema.h> | ||
|
||
#include <cassert> // assert | ||
#include <sstream> // std::ostringstream | ||
#include <stdexcept> // std::runtime_error | ||
#include <utility> // std::move | ||
|
||
namespace { | ||
|
||
auto vocabularies_to_set(const std::map<std::string, bool> &vocabularies) | ||
-> std::set<std::string> { | ||
std::set<std::string> result; | ||
for (const auto &pair : vocabularies) { | ||
result.insert(pair.first); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
} // namespace | ||
|
||
namespace sourcemeta::jsontoolkit { | ||
|
||
TransformRule::TransformRule(std::string &&name, std::string &&message) | ||
: name_{std::move(name)}, message_{std::move(message)} {} | ||
|
||
auto TransformRule::operator==(const TransformRule &other) const -> bool { | ||
return this->name() == other.name(); | ||
} | ||
|
||
auto TransformRule::name() const -> const std::string & { return this->name_; } | ||
|
||
auto TransformRule::message() const -> const std::string & { | ||
return this->message_; | ||
} | ||
|
||
auto TransformRule::apply( | ||
JSON &schema, const Pointer &pointer, const SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect) const | ||
-> std::vector<PointerProxy::Operation> { | ||
const std::optional<std::string> effective_dialect{ | ||
dialect(schema, default_dialect)}; | ||
if (!effective_dialect.has_value()) { | ||
throw SchemaError("Could not determine the schema dialect"); | ||
} | ||
|
||
const auto current_vocabularies{ | ||
vocabularies_to_set(vocabularies(schema, resolver, default_dialect))}; | ||
if (!this->condition(schema, effective_dialect.value(), current_vocabularies, | ||
pointer)) { | ||
return {}; | ||
} | ||
|
||
PointerProxy transformer{schema}; | ||
this->transform(transformer); | ||
// Otherwise the transformation didn't do anything | ||
assert(!transformer.traces().empty()); | ||
|
||
// The condition must always be false after applying the | ||
// transformation in order to avoid infinite loops | ||
if (this->condition(schema, effective_dialect.value(), current_vocabularies, | ||
pointer)) { | ||
std::ostringstream error; | ||
error << "Rule condition holds after application: " << this->name(); | ||
throw std::runtime_error(error.str()); | ||
} | ||
|
||
return transformer.traces(); | ||
} | ||
|
||
auto TransformRule::check( | ||
const JSON &schema, const Pointer &pointer, const SchemaResolver &resolver, | ||
const std::optional<std::string> &default_dialect) const -> bool { | ||
const std::optional<std::string> effective_dialect{ | ||
dialect(schema, default_dialect)}; | ||
if (!effective_dialect.has_value()) { | ||
throw SchemaError("Could not determine the schema dialect"); | ||
} | ||
|
||
return this->condition( | ||
schema, effective_dialect.value(), | ||
vocabularies_to_set(vocabularies(schema, resolver, default_dialect)), | ||
pointer); | ||
} | ||
|
||
} // namespace sourcemeta::jsontoolkit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include <memory> | ||
|
||
#include <sourcemeta/jsontoolkit/json.h> | ||
#include <sourcemeta/jsontoolkit/jsonschema.h> | ||
|
||
#include "jsonschema_transform_rules.h" | ||
|
||
TEST(JSONSchema_transform_rule, instances_of_same_rule_are_equal) { | ||
const ExampleRule1 foo{}; | ||
const ExampleRule1 bar{}; | ||
EXPECT_EQ(foo, bar); | ||
} | ||
|
||
TEST(JSONSchema_transform_rule, | ||
instances_of_same_rule_are_equal_with_unique_ptr) { | ||
const std::unique_ptr<ExampleRule1> foo{}; | ||
const std::unique_ptr<ExampleRule1> bar{}; | ||
EXPECT_EQ(foo, bar); | ||
} | ||
|
||
TEST(JSONSchema_transform_rule, instances_of_different_rules_are_different) { | ||
const ExampleRule1 foo{}; | ||
const ExampleRule2 bar{}; | ||
EXPECT_NE(foo, bar); | ||
} | ||
|
||
TEST(JSONSchema_transform_rule, rule_message) { | ||
const ExampleRule7 rule{}; | ||
EXPECT_EQ(rule.message(), "My custom message"); | ||
} |
Oops, something went wrong.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (windows/msvc)
JSON_Array_Of_Objects_Unique
401.88197544642276
ns/iter406.56563809972334
ns/iter0.99
JSON_Parse_1
78538.92857142394
ns/iter82787.30413821143
ns/iter0.95
JSON_Fast_Hash_Helm_Chart_Lock
52.29587999999694
ns/iter56.196219999992536
ns/iter0.93
JSON_Equality_Helm_Chart_Lock
186.70782917032912
ns/iter192.49284754399648
ns/iter0.97
JSON_String_Equal/10
8.976952192067394
ns/iter9.23495486948791
ns/iter0.97
JSON_String_Equal/100
9.908562499997942
ns/iter10.460860937499206
ns/iter0.95
JSON_String_Equal_Small_By_Perfect_Hash/10
2.167800000000142
ns/iter2.1950661805859735
ns/iter0.99
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.864781150456912
ns/iter15.091734374999632
ns/iter0.98
JSON_String_Fast_Hash/10
3.095317410714163
ns/iter3.1025859110234575
ns/iter1.00
JSON_String_Fast_Hash/100
3.096720535713717
ns/iter3.112848660714564
ns/iter0.99
JSON_String_Key_Hash/10
7.722917376236031
ns/iter7.59923701964758
ns/iter1.02
JSON_String_Key_Hash/100
4.0255916143317
ns/iter4.070101525125123
ns/iter0.99
JSON_Object_Defines_Miss_Same_Length
3.7213998147832523
ns/iter3.745359100455044
ns/iter0.99
JSON_Object_Defines_Miss_Too_Small
3.724421779063675
ns/iter3.75414106472489
ns/iter0.99
JSON_Object_Defines_Miss_Too_Large
4.959200000000692
ns/iter5.060330357143324
ns/iter0.98
Pointer_Object_Traverse
53.015879999998106
ns/iter52.10233928571435
ns/iter1.02
Pointer_Object_Try_Traverse
74.40119419643209
ns/iter77.32294744094332
ns/iter0.96
Pointer_Push_Back_Pointer_To_Weak_Pointer
179.62507676062816
ns/iter163.8452008928632
ns/iter1.10
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (linux/llvm)
JSON_Array_Of_Objects_Unique
439.77158500727654
ns/iter445.0056048734423
ns/iter0.99
JSON_Parse_1
30291.931003038437
ns/iter30949.60519469127
ns/iter0.98
JSON_Fast_Hash_Helm_Chart_Lock
67.783133875627
ns/iter67.74484226855972
ns/iter1.00
JSON_Equality_Helm_Chart_Lock
168.04748420794564
ns/iter155.73922495755204
ns/iter1.08
JSON_String_Equal/10
7.467981467488906
ns/iter5.910640450745298
ns/iter1.26
JSON_String_Equal/100
8.080933156746736
ns/iter6.5390087591599055
ns/iter1.24
JSON_String_Equal_Small_By_Perfect_Hash/10
0.9351357850023496
ns/iter0.936587445790056
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.605345327598277
ns/iter14.599408474021196
ns/iter1.00
JSON_String_Fast_Hash/10
2.799304468303211
ns/iter2.7960212539083047
ns/iter1.00
JSON_String_Fast_Hash/100
2.798872040520124
ns/iter2.7960857717781646
ns/iter1.00
JSON_String_Key_Hash/10
2.6970536149416517
ns/iter2.708889298216427
ns/iter1.00
JSON_String_Key_Hash/100
2.1791592128845587
ns/iter2.1786488507747745
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
3.7373141047414316
ns/iter3.738419472384038
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
3.735412365175254
ns/iter3.7550352171921983
ns/iter0.99
JSON_Object_Defines_Miss_Too_Large
3.7335068125809725
ns/iter3.742029190583183
ns/iter1.00
Pointer_Object_Traverse
43.88805912755642
ns/iter44.01402073901948
ns/iter1.00
Pointer_Object_Try_Traverse
52.58786625380949
ns/iter52.66665491857795
ns/iter1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer
289.04949606517044
ns/iter289.71550331059603
ns/iter1.00
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (windows/msvc)
JSON_Array_Of_Objects_Unique
407.4786395614008
ns/iter406.56563809972334
ns/iter1.00
JSON_Parse_1
80670.99330356494
ns/iter82787.30413821143
ns/iter0.97
JSON_Fast_Hash_Helm_Chart_Lock
53.36540000000696
ns/iter56.196219999992536
ns/iter0.95
JSON_Equality_Helm_Chart_Lock
195.54984781697777
ns/iter192.49284754399648
ns/iter1.02
JSON_String_Equal/10
8.984975852744938
ns/iter9.23495486948791
ns/iter0.97
JSON_String_Equal/100
9.952960937498647
ns/iter10.460860937499206
ns/iter0.95
JSON_String_Equal_Small_By_Perfect_Hash/10
2.167079375000114
ns/iter2.1950661805859735
ns/iter0.99
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
15.422127575296935
ns/iter15.091734374999632
ns/iter1.02
JSON_String_Fast_Hash/10
3.09363526785741
ns/iter3.1025859110234575
ns/iter1.00
JSON_String_Fast_Hash/100
3.0997607142855896
ns/iter3.112848660714564
ns/iter1.00
JSON_String_Key_Hash/10
7.4900904017852605
ns/iter7.59923701964758
ns/iter0.99
JSON_String_Key_Hash/100
4.024486033972405
ns/iter4.070101525125123
ns/iter0.99
JSON_Object_Defines_Miss_Same_Length
3.726584993345303
ns/iter3.745359100455044
ns/iter0.99
JSON_Object_Defines_Miss_Too_Small
3.7175394576471685
ns/iter3.75414106472489
ns/iter0.99
JSON_Object_Defines_Miss_Too_Large
4.966143000000329
ns/iter5.060330357143324
ns/iter0.98
Pointer_Object_Traverse
52.061214285714634
ns/iter52.10233928571435
ns/iter1.00
Pointer_Object_Try_Traverse
74.50947321428559
ns/iter77.32294744094332
ns/iter0.96
Pointer_Push_Back_Pointer_To_Weak_Pointer
179.0107218087424
ns/iter163.8452008928632
ns/iter1.09
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (macos/llvm)
JSON_Array_Of_Objects_Unique
363.41164244814377
ns/iter361.96795413338793
ns/iter1.00
JSON_Parse_1
29055.4502328631
ns/iter24329.13559322268
ns/iter1.19
JSON_Fast_Hash_Helm_Chart_Lock
65.79624330249891
ns/iter53.552792776483045
ns/iter1.23
JSON_Equality_Helm_Chart_Lock
173.45601440658496
ns/iter145.67581133132254
ns/iter1.19
JSON_String_Equal/10
10.207719155264893
ns/iter8.420756889290356
ns/iter1.21
JSON_String_Equal/100
6.5439845148480185
ns/iter6.854472796559273
ns/iter0.95
JSON_String_Equal_Small_By_Perfect_Hash/10
0.3522633799746671
ns/iter0.4502963139256893
ns/iter0.78
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.2096392036960513
ns/iter4.242059817769369
ns/iter0.76
JSON_String_Fast_Hash/10
1.7826277155249033
ns/iter2.268353871086957
ns/iter0.79
JSON_String_Fast_Hash/100
2.33328693390037
ns/iter2.5656718695358802
ns/iter0.91
JSON_String_Key_Hash/10
1.6624549268702091
ns/iter1.6007783716260415
ns/iter1.04
JSON_String_Key_Hash/100
1.5920918900570658
ns/iter1.5290090041583166
ns/iter1.04
JSON_Object_Defines_Miss_Same_Length
2.911265741243053
ns/iter2.735547293029214
ns/iter1.06
JSON_Object_Defines_Miss_Too_Small
3.0991872547439208
ns/iter2.822075821364744
ns/iter1.10
JSON_Object_Defines_Miss_Too_Large
2.971092683869107
ns/iter2.6825110258742466
ns/iter1.11
Pointer_Object_Traverse
23.5656917099432
ns/iter19.54114612331589
ns/iter1.21
Pointer_Object_Try_Traverse
32.6011158752732
ns/iter27.187477912107497
ns/iter1.20
Pointer_Push_Back_Pointer_To_Weak_Pointer
258.4030995687991
ns/iter213.0609785973912
ns/iter1.21
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (linux/llvm)
JSON_Array_Of_Objects_Unique
444.6831491422736
ns/iter445.0056048734423
ns/iter1.00
JSON_Parse_1
30016.879087354257
ns/iter30949.60519469127
ns/iter0.97
JSON_Fast_Hash_Helm_Chart_Lock
67.82667666639489
ns/iter67.74484226855972
ns/iter1.00
JSON_Equality_Helm_Chart_Lock
151.04578972679244
ns/iter155.73922495755204
ns/iter0.97
JSON_String_Equal/10
6.2263231512855315
ns/iter5.910640450745298
ns/iter1.05
JSON_String_Equal/100
6.812590101068144
ns/iter6.5390087591599055
ns/iter1.04
JSON_String_Equal_Small_By_Perfect_Hash/10
0.9350363448037401
ns/iter0.936587445790056
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
10.263595053600774
ns/iter14.599408474021196
ns/iter0.70
JSON_String_Fast_Hash/10
2.80049482658076
ns/iter2.7960212539083047
ns/iter1.00
JSON_String_Fast_Hash/100
2.798022508565562
ns/iter2.7960857717781646
ns/iter1.00
JSON_String_Key_Hash/10
2.178486488163509
ns/iter2.708889298216427
ns/iter0.80
JSON_String_Key_Hash/100
2.1793364583699812
ns/iter2.1786488507747745
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
3.7699103649701065
ns/iter3.738419472384038
ns/iter1.01
JSON_Object_Defines_Miss_Too_Small
3.733918259749967
ns/iter3.7550352171921983
ns/iter0.99
JSON_Object_Defines_Miss_Too_Large
3.7409215044847275
ns/iter3.742029190583183
ns/iter1.00
Pointer_Object_Traverse
44.511045337286205
ns/iter44.01402073901948
ns/iter1.01
Pointer_Object_Try_Traverse
52.634378553755305
ns/iter52.66665491857795
ns/iter1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer
289.3941212504647
ns/iter289.71550331059603
ns/iter1.00
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (linux/gcc)
Pointer_Object_Traverse
45.36137198550726
ns/iter46.30152205045735
ns/iter0.98
Pointer_Object_Try_Traverse
23.38338967886053
ns/iter23.357628057749224
ns/iter1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer
144.75868587545816
ns/iter144.71220300476529
ns/iter1.00
JSON_Array_Of_Objects_Unique
409.47646162791455
ns/iter421.7987507663135
ns/iter0.97
JSON_Parse_1
33470.009848917194
ns/iter33452.80865701759
ns/iter1.00
JSON_Fast_Hash_Helm_Chart_Lock
64.76877476558462
ns/iter65.0593951850862
ns/iter1.00
JSON_Equality_Helm_Chart_Lock
142.22456885646173
ns/iter144.4246132804019
ns/iter0.98
JSON_String_Equal/10
5.991679451988232
ns/iter5.991415797851993
ns/iter1.00
JSON_String_Equal/100
6.756267730009827
ns/iter6.621908568255762
ns/iter1.02
JSON_String_Equal_Small_By_Perfect_Hash/10
0.6463200041491756
ns/iter0.6266144760299274
ns/iter1.03
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.295952583763107
ns/iter14.296440776228257
ns/iter1.00
JSON_String_Fast_Hash/10
2.256779073455568
ns/iter2.2531939887434875
ns/iter1.00
JSON_String_Fast_Hash/100
2.255833224463305
ns/iter2.2539410345453286
ns/iter1.00
JSON_String_Key_Hash/10
1.983778129644623
ns/iter1.9960073950856352
ns/iter0.99
JSON_String_Key_Hash/100
1.6727201274998738
ns/iter1.6725423411864238
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
2.4893822332995117
ns/iter2.487778190919151
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
3.1285598739473053
ns/iter3.1082686960864323
ns/iter1.01
JSON_Object_Defines_Miss_Too_Large
2.7999866430787907
ns/iter2.7979304631773525
ns/iter1.00
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (macos/gcc)
JSON_Array_Of_Objects_Unique
265.48373806171037
ns/iter216.21509594941247
ns/iter1.23
JSON_Parse_1
27284.843079793613
ns/iter23828.67190302635
ns/iter1.15
JSON_Fast_Hash_Helm_Chart_Lock
26.73470523229167
ns/iter24.218518155859254
ns/iter1.10
JSON_Equality_Helm_Chart_Lock
128.4278609445176
ns/iter117.3557015951958
ns/iter1.09
JSON_String_Equal/10
6.0044203344483105
ns/iter5.579267215545694
ns/iter1.08
JSON_String_Equal/100
5.756198711807972
ns/iter5.237618055546419
ns/iter1.10
JSON_String_Equal_Small_By_Perfect_Hash/10
0.8669589993505308
ns/iter0.7734738449834633
ns/iter1.12
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.403854707406344
ns/iter2.99620526250668
ns/iter1.14
JSON_String_Fast_Hash/10
2.155209136543456
ns/iter1.955507152007
ns/iter1.10
JSON_String_Fast_Hash/100
2.1927889200459236
ns/iter2.024872705958354
ns/iter1.08
JSON_String_Key_Hash/10
1.5866654329945047
ns/iter1.3100397677736282
ns/iter1.21
JSON_String_Key_Hash/100
1.953092742825081
ns/iter1.782364311081305
ns/iter1.10
JSON_Object_Defines_Miss_Same_Length
1.83401508070085
ns/iter1.796509234033133
ns/iter1.02
JSON_Object_Defines_Miss_Too_Small
2.24089132118328
ns/iter1.9528465300801838
ns/iter1.15
JSON_Object_Defines_Miss_Too_Large
1.9047236451432341
ns/iter1.7858692632762243
ns/iter1.07
Pointer_Object_Traverse
55.845487028638665
ns/iter53.20884450834256
ns/iter1.05
Pointer_Object_Try_Traverse
39.965027060481205
ns/iter36.94768250329327
ns/iter1.08
Pointer_Push_Back_Pointer_To_Weak_Pointer
182.07918926054853
ns/iter165.28141894184168
ns/iter1.10
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (macos/llvm)
JSON_Array_Of_Objects_Unique
395.1483350499182
ns/iter361.96795413338793
ns/iter1.09
JSON_Parse_1
24974.770402838567
ns/iter24329.13559322268
ns/iter1.03
JSON_Fast_Hash_Helm_Chart_Lock
53.1265033383471
ns/iter53.552792776483045
ns/iter0.99
JSON_Equality_Helm_Chart_Lock
135.810214879401
ns/iter145.67581133132254
ns/iter0.93
JSON_String_Equal/10
8.864542148652852
ns/iter8.420756889290356
ns/iter1.05
JSON_String_Equal/100
7.7508701684388885
ns/iter6.854472796559273
ns/iter1.13
JSON_String_Equal_Small_By_Perfect_Hash/10
0.3799838229984226
ns/iter0.4502963139256893
ns/iter0.84
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.4366952710940297
ns/iter4.242059817769369
ns/iter0.81
JSON_String_Fast_Hash/10
1.8604538086001505
ns/iter2.268353871086957
ns/iter0.82
JSON_String_Fast_Hash/100
2.13902548909534
ns/iter2.5656718695358802
ns/iter0.83
JSON_String_Key_Hash/10
1.478180025600961
ns/iter1.6007783716260415
ns/iter0.92
JSON_String_Key_Hash/100
1.517665669829939
ns/iter1.5290090041583166
ns/iter0.99
JSON_Object_Defines_Miss_Same_Length
2.982966507113585
ns/iter2.735547293029214
ns/iter1.09
JSON_Object_Defines_Miss_Too_Small
2.6861336496986756
ns/iter2.822075821364744
ns/iter0.95
JSON_Object_Defines_Miss_Too_Large
2.5021834683255872
ns/iter2.6825110258742466
ns/iter0.93
Pointer_Object_Traverse
17.031074076304186
ns/iter19.54114612331589
ns/iter0.87
Pointer_Object_Try_Traverse
25.287444168734403
ns/iter27.187477912107497
ns/iter0.93
Pointer_Push_Back_Pointer_To_Weak_Pointer
201.2126501374894
ns/iter213.0609785973912
ns/iter0.94
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (linux/gcc)
Pointer_Object_Traverse
45.944966357088454
ns/iter46.30152205045735
ns/iter0.99
Pointer_Object_Try_Traverse
23.353982525499525
ns/iter23.357628057749224
ns/iter1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer
151.646416343823
ns/iter144.71220300476529
ns/iter1.05
JSON_Array_Of_Objects_Unique
409.4892997797525
ns/iter421.7987507663135
ns/iter0.97
JSON_Parse_1
33645.466469185674
ns/iter33452.80865701759
ns/iter1.01
JSON_Fast_Hash_Helm_Chart_Lock
70.69618569734308
ns/iter65.0593951850862
ns/iter1.09
JSON_Equality_Helm_Chart_Lock
143.03748264502008
ns/iter144.4246132804019
ns/iter0.99
JSON_String_Equal/10
5.992041300778191
ns/iter5.991415797851993
ns/iter1.00
JSON_String_Equal/100
6.617679268281156
ns/iter6.621908568255762
ns/iter1.00
JSON_String_Equal_Small_By_Perfect_Hash/10
0.6250877061246954
ns/iter0.6266144760299274
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.28687224230198
ns/iter14.296440776228257
ns/iter1.00
JSON_String_Fast_Hash/10
2.259285654091427
ns/iter2.2531939887434875
ns/iter1.00
JSON_String_Fast_Hash/100
2.2532145160237107
ns/iter2.2539410345453286
ns/iter1.00
JSON_String_Key_Hash/10
1.9841745110967128
ns/iter1.9960073950856352
ns/iter0.99
JSON_String_Key_Hash/100
1.6715523767793665
ns/iter1.6725423411864238
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
2.486002855049122
ns/iter2.487778190919151
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
3.1217560007426135
ns/iter3.1082686960864323
ns/iter1.00
JSON_Object_Defines_Miss_Too_Large
2.8035153017620473
ns/iter2.7979304631773525
ns/iter1.00
This comment was automatically generated by workflow using github-action-benchmark.
0fc100e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark (macos/gcc)
JSON_Array_Of_Objects_Unique
225.53524386811998
ns/iter216.21509594941247
ns/iter1.04
JSON_Parse_1
27628.742809797695
ns/iter23828.67190302635
ns/iter1.16
JSON_Fast_Hash_Helm_Chart_Lock
25.135020231942192
ns/iter24.218518155859254
ns/iter1.04
JSON_Equality_Helm_Chart_Lock
118.70276494535462
ns/iter117.3557015951958
ns/iter1.01
JSON_String_Equal/10
5.74125390298375
ns/iter5.579267215545694
ns/iter1.03
JSON_String_Equal/100
5.6180782925244666
ns/iter5.237618055546419
ns/iter1.07
JSON_String_Equal_Small_By_Perfect_Hash/10
0.8840167728124099
ns/iter0.7734738449834633
ns/iter1.14
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.090206258294578
ns/iter2.99620526250668
ns/iter1.03
JSON_String_Fast_Hash/10
2.014704005178141
ns/iter1.955507152007
ns/iter1.03
JSON_String_Fast_Hash/100
1.9870587616447017
ns/iter2.024872705958354
ns/iter0.98
JSON_String_Key_Hash/10
1.3433741904770458
ns/iter1.3100397677736282
ns/iter1.03
JSON_String_Key_Hash/100
1.7411116237888928
ns/iter1.782364311081305
ns/iter0.98
JSON_Object_Defines_Miss_Same_Length
1.756216489417419
ns/iter1.796509234033133
ns/iter0.98
JSON_Object_Defines_Miss_Too_Small
1.9377998265711915
ns/iter1.9528465300801838
ns/iter0.99
JSON_Object_Defines_Miss_Too_Large
1.7710241638774564
ns/iter1.7858692632762243
ns/iter0.99
Pointer_Object_Traverse
52.390000805969215
ns/iter53.20884450834256
ns/iter0.98
Pointer_Object_Try_Traverse
35.84086767736914
ns/iter36.94768250329327
ns/iter0.97
Pointer_Push_Back_Pointer_To_Weak_Pointer
161.9926789795267
ns/iter165.28141894184168
ns/iter0.98
This comment was automatically generated by workflow using github-action-benchmark.