-
-
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.
Benchmark schema framing and bundling (#1535)
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
4 changed files
with
4,531 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <benchmark/benchmark.h> | ||
|
||
#include <cassert> // assert | ||
#include <filesystem> // std::filesystem | ||
|
||
#include <sourcemeta/core/json.h> | ||
#include <sourcemeta/core/jsonschema.h> | ||
|
||
static void Schema_Frame_OMC_Full(benchmark::State &state) { | ||
const auto schema{ | ||
sourcemeta::core::read_json(std::filesystem::path{CURRENT_DIRECTORY} / | ||
"schemas" / "2019_09_omc_json_v2.json")}; | ||
|
||
for (auto _ : state) { | ||
sourcemeta::core::SchemaFrame frame; | ||
frame.analyse(schema, sourcemeta::core::schema_official_walker, | ||
sourcemeta::core::schema_official_resolver); | ||
benchmark::DoNotOptimize(frame); | ||
} | ||
} | ||
|
||
static void Schema_Bundle_Meta_2020_12(benchmark::State &state) { | ||
for (auto _ : state) { | ||
state.PauseTiming(); | ||
auto schema{sourcemeta::core::schema_official_resolver( | ||
"https://json-schema.org/draft/2020-12/schema") | ||
.value()}; | ||
state.ResumeTiming(); | ||
sourcemeta::core::bundle(schema, sourcemeta::core::schema_official_walker, | ||
sourcemeta::core::schema_official_resolver); | ||
benchmark::DoNotOptimize(schema); | ||
} | ||
} | ||
|
||
BENCHMARK(Schema_Frame_OMC_Full); | ||
BENCHMARK(Schema_Bundle_Meta_2020_12); |
Oops, something went wrong.
fda03b1
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)
Regex_Lower_S_Or_Upper_S_Asterisk
2.2336741487646257
ns/iter2.208021862417692
ns/iter1.01
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
2.1998278574521093
ns/iter2.2187659337827963
ns/iter0.99
Regex_Period_Asterisk
2.2030333650856577
ns/iter2.19349554413125
ns/iter1.00
Regex_Group_Period_Asterisk_Group
2.2006870220245505
ns/iter2.1922307558560457
ns/iter1.00
Regex_Period_Plus
2.4932381471042055
ns/iter2.7987754633697697
ns/iter0.89
Regex_Period
2.486912626682726
ns/iter2.7974824678243695
ns/iter0.89
Regex_Caret_Period_Plus_Dollar
2.4868855823286515
ns/iter2.7124137146987755
ns/iter0.92
Regex_Caret_Group_Period_Plus_Group_Dollar
2.4871614658758228
ns/iter2.494198222495843
ns/iter1.00
Regex_Caret_Period_Asterisk_Dollar
3.4182787055000214
ns/iter2.48709447503305
ns/iter1.37
Regex_Caret_Group_Period_Asterisk_Group_Dollar
3.4206254740223927
ns/iter2.487580809084268
ns/iter1.38
Regex_Caret_X_Hyphen
13.056098282204163
ns/iter12.557450078399288
ns/iter1.04
Regex_Period_Md_Dollar
73.46712957188181
ns/iter81.48550054729482
ns/iter0.90
Regex_Caret_Slash_Period_Asterisk
7.156694735849628
ns/iter6.836807689798791
ns/iter1.05
Regex_Caret_Period_Range_Dollar
3.7316836168284913
ns/iter4.049755814944138
ns/iter0.92
Regex_Nested_Backtrack
485.2630255048362
ns/iter498.97766416008653
ns/iter0.97
JSON_Array_Of_Objects_Unique
402.45412710769835
ns/iter395.71622325758597
ns/iter1.02
JSON_Parse_1
30407.57334313253
ns/iter30264.86893811883
ns/iter1.00
JSON_Fast_Hash_Helm_Chart_Lock
59.598606247993644
ns/iter59.27372464286649
ns/iter1.01
JSON_Equality_Helm_Chart_Lock
165.11003232527395
ns/iter151.28876435722154
ns/iter1.09
JSON_String_Equal/10
7.787664065285024
ns/iter6.222311946726939
ns/iter1.25
JSON_String_Equal/100
8.407204586793029
ns/iter6.846443829393279
ns/iter1.23
JSON_String_Equal_Small_By_Perfect_Hash/10
0.9384289914300863
ns/iter0.9424937912188245
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.640083799115693
ns/iter14.605334343782243
ns/iter1.00
JSON_String_Fast_Hash/10
2.175940174776645
ns/iter2.4868351378471973
ns/iter0.87
JSON_String_Fast_Hash/100
2.175741868528294
ns/iter2.488821343837131
ns/iter0.87
JSON_String_Key_Hash/10
2.6701311682197795
ns/iter2.690990453268772
ns/iter0.99
JSON_String_Key_Hash/100
2.178798735946459
ns/iter1.8683964563703193
ns/iter1.17
JSON_Object_Defines_Miss_Same_Length
3.734540959201007
ns/iter3.736391702590776
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
3.7334752803021507
ns/iter3.73749015385384
ns/iter1.00
JSON_Object_Defines_Miss_Too_Large
3.7398870239541897
ns/iter3.7490742044325898
ns/iter1.00
Pointer_Object_Traverse
44.43611001304772
ns/iter45.66784182641732
ns/iter0.97
Pointer_Object_Try_Traverse
52.37266170773179
ns/iter52.340079814325634
ns/iter1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer
357.29744783983693
ns/iter308.4121688287477
ns/iter1.16
Schema_Frame_OMC_Full
232583570.33334205
ns/iterSchema_Bundle_Meta_2020_12
10353314.661764845
ns/iterThis comment was automatically generated by workflow using github-action-benchmark.
fda03b1
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)
Regex_Lower_S_Or_Upper_S_Asterisk
1.7137214696524412
ns/iter1.6005033090280567
ns/iter1.07
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
1.740183745510081
ns/iter1.5819935659271185
ns/iter1.10
Regex_Period_Asterisk
1.8274557066684596
ns/iter1.6034357876071554
ns/iter1.14
Regex_Group_Period_Asterisk_Group
1.7018531408990956
ns/iter1.5933444494088242
ns/iter1.07
Regex_Period_Plus
2.0299604587211713
ns/iter1.907692384950933
ns/iter1.06
Regex_Period
2.0467096858204434
ns/iter1.9056890528671944
ns/iter1.07
Regex_Caret_Period_Plus_Dollar
2.0233620684731446
ns/iter1.915318253234105
ns/iter1.06
Regex_Caret_Group_Period_Plus_Group_Dollar
2.2884759793187195
ns/iter1.911938249642208
ns/iter1.20
Regex_Caret_Period_Asterisk_Dollar
1.7009053337551143
ns/iter1.5762425316873254
ns/iter1.08
Regex_Caret_Group_Period_Asterisk_Group_Dollar
1.6979726504083035
ns/iter1.5727729378020239
ns/iter1.08
Regex_Caret_X_Hyphen
7.121488707866663
ns/iter6.604917572526963
ns/iter1.08
Regex_Period_Md_Dollar
73.11886334830353
ns/iter69.21095723712322
ns/iter1.06
Regex_Caret_Slash_Period_Asterisk
5.580149036592864
ns/iter5.037225277585012
ns/iter1.11
Regex_Caret_Period_Range_Dollar
2.368089762335691
ns/iter2.2054844942210274
ns/iter1.07
Regex_Nested_Backtrack
791.0111391841551
ns/iter730.3327330798342
ns/iter1.08
JSON_Array_Of_Objects_Unique
352.0678359507631
ns/iter356.11771721210295
ns/iter0.99
JSON_Parse_1
23371.222222222772
ns/iter22697.92309938579
ns/iter1.03
JSON_Fast_Hash_Helm_Chart_Lock
51.35871365720913
ns/iter50.26750604403888
ns/iter1.02
JSON_Equality_Helm_Chart_Lock
125.71266315040694
ns/iter125.85440214778711
ns/iter1.00
JSON_String_Equal/10
8.74230628030261
ns/iter7.983238167711032
ns/iter1.10
JSON_String_Equal/100
6.480534694471614
ns/iter6.308694876982772
ns/iter1.03
JSON_String_Equal_Small_By_Perfect_Hash/10
0.33817903637576774
ns/iter0.3144628144093694
ns/iter1.08
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.203461165353918
ns/iter2.957314153188983
ns/iter1.08
JSON_String_Fast_Hash/10
1.7214694705522184
ns/iter1.5742594198333677
ns/iter1.09
JSON_String_Fast_Hash/100
2.0667852455348115
ns/iter1.8833454397937255
ns/iter1.10
JSON_String_Key_Hash/10
1.3492895708258672
ns/iter1.2551009747921291
ns/iter1.08
JSON_String_Key_Hash/100
1.35164620721881
ns/iter1.2580400366286333
ns/iter1.07
JSON_Object_Defines_Miss_Same_Length
2.357502254807884
ns/iter2.2074019202742785
ns/iter1.07
JSON_Object_Defines_Miss_Too_Small
2.3636122978048575
ns/iter2.212362682226433
ns/iter1.07
JSON_Object_Defines_Miss_Too_Large
2.412681881764084
ns/iter2.209355162663776
ns/iter1.09
Pointer_Object_Traverse
19.70547256100379
ns/iter17.015462267744606
ns/iter1.16
Pointer_Object_Try_Traverse
26.587518635235295
ns/iter21.72096060644557
ns/iter1.22
Pointer_Push_Back_Pointer_To_Weak_Pointer
203.81207581209424
ns/iter173.15569965109046
ns/iter1.18
Schema_Frame_OMC_Full
178876072.99999785
ns/iterSchema_Bundle_Meta_2020_12
7944661.533329307
ns/iterThis comment was automatically generated by workflow using github-action-benchmark.
fda03b1
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)
Regex_Lower_S_Or_Upper_S_Asterisk
6.690396205356766
ns/iter7.169602678572013
ns/iter0.93
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
6.799989955358195
ns/iter6.847720982143812
ns/iter0.99
Regex_Period_Asterisk
6.598251116070993
ns/iter7.071218749999783
ns/iter0.93
Regex_Group_Period_Asterisk_Group
6.857341964285573
ns/iter6.898632812501709
ns/iter0.99
Regex_Period_Plus
6.985137276784213
ns/iter7.150731026787887
ns/iter0.98
Regex_Period
7.277477678570168
ns/iter7.211098214286591
ns/iter1.01
Regex_Caret_Period_Plus_Dollar
7.054868303570621
ns/iter7.329225446428872
ns/iter0.96
Regex_Caret_Group_Period_Plus_Group_Dollar
6.900253094195784
ns/iter7.591810680393215
ns/iter0.91
Regex_Caret_Period_Asterisk_Dollar
6.682283035715386
ns/iter6.865803987206296
ns/iter0.97
Regex_Caret_Group_Period_Asterisk_Group_Dollar
6.883854910714352
ns/iter7.357767857144434
ns/iter0.94
Regex_Caret_X_Hyphen
14.45242857142505
ns/iter11.835117187498412
ns/iter1.22
Regex_Period_Md_Dollar
146.97696442065094
ns/iter150.0962946428684
ns/iter0.98
Regex_Caret_Slash_Period_Asterisk
10.21878437499879
ns/iter10.748451562498929
ns/iter0.95
Regex_Caret_Period_Range_Dollar
7.459709821426535
ns/iter7.7571066617990665
ns/iter0.96
Regex_Nested_Backtrack
591.9013000000177
ns/iter620.0021428570933
ns/iter0.95
JSON_Array_Of_Objects_Unique
420.4773938246067
ns/iter490.08069999990767
ns/iter0.86
JSON_Parse_1
97270.81826704559
ns/iter80089.5535714322
ns/iter1.21
JSON_Fast_Hash_Helm_Chart_Lock
54.291970000008405
ns/iter63.04024999999618
ns/iter0.86
JSON_Equality_Helm_Chart_Lock
188.9828472306345
ns/iter183.56037353214683
ns/iter1.03
JSON_String_Equal/10
9.451536118520519
ns/iter8.97498478136031
ns/iter1.05
JSON_String_Equal/100
10.316693749999217
ns/iter9.932837902083557
ns/iter1.04
JSON_String_Equal_Small_By_Perfect_Hash/10
2.170701874999992
ns/iter2.1646293749995493
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.393411510753863
ns/iter14.732678026341766
ns/iter0.98
JSON_String_Fast_Hash/10
3.1038580357147794
ns/iter4.051360632234062
ns/iter0.77
JSON_String_Fast_Hash/100
3.1043620535718173
ns/iter4.052011718749883
ns/iter0.77
JSON_String_Key_Hash/10
7.5131964285723996
ns/iter8.043931919642842
ns/iter0.93
JSON_String_Key_Hash/100
3.7421673147462333
ns/iter4.024076882186663
ns/iter0.93
JSON_Object_Defines_Miss_Same_Length
4.064358815150397
ns/iter3.717636421932891
ns/iter1.09
JSON_Object_Defines_Miss_Too_Small
3.415517672471738
ns/iter4.959002880571053
ns/iter0.69
JSON_Object_Defines_Miss_Too_Large
3.766335528988553
ns/iter3.405209536570648
ns/iter1.11
Pointer_Object_Traverse
52.48794999999973
ns/iter55.46846428570364
ns/iter0.95
Pointer_Object_Try_Traverse
65.40291964286992
ns/iter67.4814843750125
ns/iter0.97
Pointer_Push_Back_Pointer_To_Weak_Pointer
162.11872290973392
ns/iter182.18157876623832
ns/iter0.89
Schema_Frame_OMC_Full
473063700.0000115
ns/iterSchema_Bundle_Meta_2020_12
23273949.999997966
ns/iterThis comment was automatically generated by workflow using github-action-benchmark.
fda03b1
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)
Schema_Frame_OMC_Full
236797640.3333311
ns/iterSchema_Bundle_Meta_2020_12
10586084.803023685
ns/iterPointer_Object_Traverse
46.81200242408507
ns/iter45.72913939315886
ns/iter1.02
Pointer_Object_Try_Traverse
22.97158781708668
ns/iter26.160012567511075
ns/iter0.88
Pointer_Push_Back_Pointer_To_Weak_Pointer
175.49131103956395
ns/iter145.2647694086727
ns/iter1.21
JSON_Array_Of_Objects_Unique
396.11499510424005
ns/iter409.4451619196503
ns/iter0.97
JSON_Parse_1
34568.253961457485
ns/iter33207.55535528025
ns/iter1.04
JSON_Fast_Hash_Helm_Chart_Lock
63.08419691361196
ns/iter62.82689855947769
ns/iter1.00
JSON_Equality_Helm_Chart_Lock
152.0929075735853
ns/iter152.1986948167015
ns/iter1.00
JSON_String_Equal/10
5.95740197832579
ns/iter6.3562416380697995
ns/iter0.94
JSON_String_Equal/100
6.60326600057428
ns/iter6.963132804237056
ns/iter0.95
JSON_String_Equal_Small_By_Perfect_Hash/10
0.6236909884266193
ns/iter0.9339321979351424
ns/iter0.67
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
11.678899622542186
ns/iter14.28745929080262
ns/iter0.82
JSON_String_Fast_Hash/10
0.9413067412028505
ns/iter0.9342374574368694
ns/iter1.01
JSON_String_Fast_Hash/100
0.9330292259327174
ns/iter0.9321220771214092
ns/iter1.00
JSON_String_Key_Hash/10
1.2798826596108541
ns/iter1.6728827664919286
ns/iter0.77
JSON_String_Key_Hash/100
0.9338053372460723
ns/iter1.9849201451053429
ns/iter0.47
JSON_Object_Defines_Miss_Same_Length
2.488661350250763
ns/iter2.4864207869632198
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
2.501112228666333
ns/iter2.4938347768095053
ns/iter1.00
JSON_Object_Defines_Miss_Too_Large
2.7972271675506932
ns/iter3.1072256198248587
ns/iter0.90
Regex_Lower_S_Or_Upper_S_Asterisk
3.4260464462651723
ns/iter3.416893860668354
ns/iter1.00
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
3.4220049367608136
ns/iter3.4178798542064843
ns/iter1.00
Regex_Period_Asterisk
3.4228110389579234
ns/iter3.4174134229406805
ns/iter1.00
Regex_Group_Period_Asterisk_Group
3.4258876544149124
ns/iter3.4172123606485476
ns/iter1.00
Regex_Period_Plus
3.740245466141779
ns/iter3.7311665895237627
ns/iter1.00
Regex_Period
3.734240957090219
ns/iter3.732884738996201
ns/iter1.00
Regex_Caret_Period_Plus_Dollar
3.735879220551134
ns/iter3.7824330975082474
ns/iter0.99
Regex_Caret_Group_Period_Plus_Group_Dollar
3.729458822337646
ns/iter3.7347743790343557
ns/iter1.00
Regex_Caret_Period_Asterisk_Dollar
4.66305252035665
ns/iter4.680461129826511
ns/iter1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar
4.663468017888071
ns/iter4.659718631298085
ns/iter1.00
Regex_Caret_X_Hyphen
13.685841694399066
ns/iter12.42730900911117
ns/iter1.10
Regex_Period_Md_Dollar
89.27482095114195
ns/iter90.60116152432713
ns/iter0.99
Regex_Caret_Slash_Period_Asterisk
9.659672161367928
ns/iter8.087220142700042
ns/iter1.19
Regex_Caret_Period_Range_Dollar
4.662041599379986
ns/iter4.663859804715464
ns/iter1.00
Regex_Nested_Backtrack
824.0128051375157
ns/iter841.0069246840136
ns/iter0.98
This comment was automatically generated by workflow using github-action-benchmark.
fda03b1
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)
Regex_Lower_S_Or_Upper_S_Asterisk
1.8819393735658194
ns/iter1.942308208049288
ns/iter0.97
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
1.8865815551340634
ns/iter1.971949163589552
ns/iter0.96
Regex_Period_Asterisk
1.8815880617887382
ns/iter1.9601821664321628
ns/iter0.96
Regex_Group_Period_Asterisk_Group
1.8815222917460157
ns/iter2.0070165203141896
ns/iter0.94
Regex_Period_Plus
1.568298186804448
ns/iter1.6520101143195736
ns/iter0.95
Regex_Period
1.5674850176895074
ns/iter1.6480848700237498
ns/iter0.95
Regex_Caret_Period_Plus_Dollar
1.567882934604193
ns/iter1.645262758229758
ns/iter0.95
Regex_Caret_Group_Period_Plus_Group_Dollar
1.5701730750578107
ns/iter1.638210127874993
ns/iter0.96
Regex_Caret_Period_Asterisk_Dollar
1.8951602922147244
ns/iter1.913669707771042
ns/iter0.99
Regex_Caret_Group_Period_Asterisk_Group_Dollar
1.8839616515132878
ns/iter1.8821126741404421
ns/iter1.00
Regex_Caret_X_Hyphen
5.961069647159391
ns/iter5.984971832891739
ns/iter1.00
Regex_Period_Md_Dollar
71.47107863668744
ns/iter68.55810494357878
ns/iter1.04
Regex_Caret_Slash_Period_Asterisk
4.396877786369835
ns/iter4.403668350466067
ns/iter1.00
Regex_Caret_Period_Range_Dollar
1.8809101826593893
ns/iter1.8910105821192318
ns/iter0.99
Regex_Nested_Backtrack
847.1087546916384
ns/iter823.6459975707054
ns/iter1.03
JSON_Array_Of_Objects_Unique
200.49322175626634
ns/iter211.7466776304995
ns/iter0.95
JSON_Parse_1
23107.85438039079
ns/iter23493.3565616984
ns/iter0.98
JSON_Fast_Hash_Helm_Chart_Lock
23.423087280009902
ns/iter27.36812464669376
ns/iter0.86
JSON_Equality_Helm_Chart_Lock
113.91210945414859
ns/iter122.41537661218275
ns/iter0.93
JSON_String_Equal/10
5.372109582476497
ns/iter5.522329764169248
ns/iter0.97
JSON_String_Equal/100
5.087144367338979
ns/iter5.338538446069286
ns/iter0.95
JSON_String_Equal_Small_By_Perfect_Hash/10
0.7464216457152769
ns/iter0.7490413893868775
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.450758477807526
ns/iter3.4540067915532937
ns/iter1.00
JSON_String_Fast_Hash/10
1.8921518330145015
ns/iter1.8922922417019556
ns/iter1.00
JSON_String_Fast_Hash/100
1.9019557366011353
ns/iter1.8938424291329004
ns/iter1.00
JSON_String_Key_Hash/10
1.4330597408007124
ns/iter1.4465351338172594
ns/iter0.99
JSON_String_Key_Hash/100
1.9238142491309502
ns/iter1.9231579028533623
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
1.7309543696857883
ns/iter1.726076138951353
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
1.8837757507252442
ns/iter1.8838163231790193
ns/iter1.00
JSON_Object_Defines_Miss_Too_Large
1.7252176388473617
ns/iter1.7251743593506008
ns/iter1.00
Pointer_Object_Traverse
53.68908335450118
ns/iter52.34051195706453
ns/iter1.03
Pointer_Object_Try_Traverse
35.96947147862546
ns/iter35.740934884215875
ns/iter1.01
Pointer_Push_Back_Pointer_To_Weak_Pointer
156.05208907179644
ns/iter154.1202827052081
ns/iter1.01
Schema_Frame_OMC_Full
184282779.69360352
ns/iterSchema_Bundle_Meta_2020_12
9211242.934803903
ns/iterThis comment was automatically generated by workflow using github-action-benchmark.