-
-
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.
Signed-off-by: Juan Cruz Viotti <[email protected]>
- Loading branch information
Showing
416 changed files
with
10,712 additions
and
13,377 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
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
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 |
---|---|---|
@@ -1,43 +1,10 @@ | ||
![JSON Toolkit](./assets/banner.png) | ||
Sourcemeta Core | ||
=============== | ||
|
||
JSON Toolkit is a swiss-army knife for [JSON](https://www.json.org) programming | ||
in modern C++. It comes with a built-in parser and growing support for | ||
standards such as [JSON Schema](http://json-schema.org), [JSON | ||
Pointer](https://www.rfc-editor.org/rfc/rfc6901), | ||
[JSONL](https://jsonlines.org), and more. For example: | ||
|
||
```cpp | ||
#include <sourcemeta/jsontoolkit/json.h> | ||
#include <sourcemeta/jsontoolkit/jsonpointer.h> | ||
|
||
#include <sstream> | ||
#include <iostream> | ||
#include <stdlib> | ||
#include <utility> | ||
|
||
auto main() -> int { | ||
// Parsing a JSON document from a string | ||
auto document{sourcemeta::jsontoolkit::parse(R"JSON({ | ||
"name": "John Doe", | ||
"age": 20, | ||
"address": "14 Manchester Road, Coventry CV77 1XN" | ||
})JSON")}; | ||
|
||
// Updating a property using JSON Pointer | ||
const sourcemeta::jsontoolkit::Pointer pointer{"name"}; | ||
sourcemeta::jsontoolkit::JSON new_value{"Jane Doe"}; | ||
sourcemeta::jsontoolkit::set(document, pointer, std::move(new_value)); | ||
|
||
// Pretty-print result | ||
sourcemeta::jsontoolkit::prettify(document, std::cout); | ||
std::cout << "\n"; | ||
|
||
return EXIT_SUCCESS; | ||
} | ||
``` | ||
This project implements a set of foundational C++ libraries to power Sourcemeta projects. | ||
|
||
Documentation | ||
------------- | ||
|
||
Refer to the project website for documentation: | ||
[https://jsontoolkit.sourcemeta.com](https://jsontoolkit.sourcemeta.com). | ||
[https://core.sourcemeta.com](https://core.sourcemeta.com). |
Binary file not shown.
Oops, something went wrong.
201aa7f
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.234541442016952
ns/iter2.181993820538874
ns/iter1.02
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
2.2024855874712386
ns/iter2.177077907827837
ns/iter1.01
Regex_Period_Asterisk
2.2002548888487614
ns/iter2.1809174422416104
ns/iter1.01
Regex_Group_Period_Asterisk_Group
2.2370510096000604
ns/iter2.1772810402707448
ns/iter1.03
Regex_Period_Plus
2.48771677433371
ns/iter2.7975844988564624
ns/iter0.89
Regex_Period
2.488749336746948
ns/iter2.7969594415190673
ns/iter0.89
Regex_Caret_Period_Plus_Dollar
2.51439839359413
ns/iter2.7969556203286277
ns/iter0.90
Regex_Caret_Group_Period_Plus_Group_Dollar
2.4879646685561396
ns/iter2.796720504784179
ns/iter0.89
Regex_Caret_Period_Asterisk_Dollar
2.4880796013226716
ns/iter3.433451500593241
ns/iter0.72
Regex_Caret_Group_Period_Asterisk_Group_Dollar
2.49285731953339
ns/iter3.4258069182518867
ns/iter0.73
Regex_Caret_X_Hyphen
12.581782002696478
ns/iter12.523264325082303
ns/iter1.00
Regex_Period_Md_Dollar
81.53006497706555
ns/iter81.17721512844663
ns/iter1.00
Regex_Caret_Slash_Period_Asterisk
6.8350707223293
ns/iter6.8377376738749165
ns/iter1.00
Regex_Caret_Period_Range_Dollar
4.038831383660905
ns/iter4.0435397163846565
ns/iter1.00
Regex_Nested_Backtrack
505.5526130000203
ns/iter496.9647782709034
ns/iter1.02
JSON_Array_Of_Objects_Unique
407.7814760423842
ns/iter410.565840079819
ns/iter0.99
JSON_Parse_1
30964.134514376492
ns/iter30281.337211816608
ns/iter1.02
JSON_Fast_Hash_Helm_Chart_Lock
58.45663571846452
ns/iter58.4247273119983
ns/iter1.00
JSON_Equality_Helm_Chart_Lock
155.54109477933585
ns/iter151.35329761653338
ns/iter1.03
JSON_String_Equal/10
7.470517051613525
ns/iter6.357001437451218
ns/iter1.18
JSON_String_Equal/100
8.089376195533045
ns/iter6.538159445778147
ns/iter1.24
JSON_String_Equal_Small_By_Perfect_Hash/10
0.9343899882056494
ns/iter0.9358319404049869
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.603027262407709
ns/iter10.256476882947247
ns/iter1.42
JSON_String_Fast_Hash/10
2.4907434544532294
ns/iter2.486280176740598
ns/iter1.00
JSON_String_Fast_Hash/100
2.486285618399496
ns/iter2.4861457999653496
ns/iter1.00
JSON_String_Key_Hash/10
2.6903106877732
ns/iter2.1784861312872947
ns/iter1.23
JSON_String_Key_Hash/100
1.8667761976669963
ns/iter1.8673342063362413
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
3.7322901520026517
ns/iter3.7335846646437147
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
3.7365192721707583
ns/iter3.732124503197664
ns/iter1.00
JSON_Object_Defines_Miss_Too_Large
3.7347947960852577
ns/iter3.7333468923177464
ns/iter1.00
Pointer_Object_Traverse
44.097723342536035
ns/iter44.47468654059776
ns/iter0.99
Pointer_Object_Try_Traverse
52.44321353971982
ns/iter52.36364316240426
ns/iter1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer
293.30749911487163
ns/iter346.0390311203587
ns/iter0.85
This comment was automatically generated by workflow using github-action-benchmark.
201aa7f
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.5980835741414527
ns/iter2.239731448662294
ns/iter0.71
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
1.6178076402601649
ns/iter2.1731349397165367
ns/iter0.74
Regex_Period_Asterisk
1.7000222243000345
ns/iter2.2187470607773685
ns/iter0.77
Regex_Group_Period_Asterisk_Group
1.646715353420005
ns/iter2.405942818625018
ns/iter0.68
Regex_Period_Plus
1.989010734272712
ns/iter2.4354742464044206
ns/iter0.82
Regex_Period
1.929641275031006
ns/iter2.9571128905010866
ns/iter0.65
Regex_Caret_Period_Plus_Dollar
1.9530980722652274
ns/iter2.971099448348263
ns/iter0.66
Regex_Caret_Group_Period_Plus_Group_Dollar
1.9175469738652193
ns/iter3.108567091802745
ns/iter0.62
Regex_Caret_Period_Asterisk_Dollar
1.5892039966108558
ns/iter2.343431552612842
ns/iter0.68
Regex_Caret_Group_Period_Asterisk_Group_Dollar
1.5880433408592722
ns/iter2.618049549863509
ns/iter0.61
Regex_Caret_X_Hyphen
7.09987252347412
ns/iter9.126104539082466
ns/iter0.78
Regex_Period_Md_Dollar
78.71113424916216
ns/iter107.71977799045625
ns/iter0.73
Regex_Caret_Slash_Period_Asterisk
5.9977220086867
ns/iter7.12902157390677
ns/iter0.84
Regex_Caret_Period_Range_Dollar
2.2941047775935175
ns/iter3.1314605679376113
ns/iter0.73
Regex_Nested_Backtrack
748.1979835603626
ns/iter1034.1907476842046
ns/iter0.72
JSON_Array_Of_Objects_Unique
341.2802203106311
ns/iter475.5018402696027
ns/iter0.72
JSON_Parse_1
22309.748020226725
ns/iter36833.004631038835
ns/iter0.61
JSON_Fast_Hash_Helm_Chart_Lock
50.12458306397027
ns/iter64.14975537997898
ns/iter0.78
JSON_Equality_Helm_Chart_Lock
124.82250927194394
ns/iter190.23660766837705
ns/iter0.66
JSON_String_Equal/10
7.585058122571117
ns/iter10.0688643324011
ns/iter0.75
JSON_String_Equal/100
6.087380636999724
ns/iter8.32844192677715
ns/iter0.73
JSON_String_Equal_Small_By_Perfect_Hash/10
0.32236434209362524
ns/iter0.4102449690428305
ns/iter0.79
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.0228871540369577
ns/iter3.9156191709947485
ns/iter0.77
JSON_String_Fast_Hash/10
1.601857180018503
ns/iter2.5049175532113614
ns/iter0.64
JSON_String_Fast_Hash/100
2.001242060126806
ns/iter2.3427240917100924
ns/iter0.85
JSON_String_Key_Hash/10
1.3000064089785373
ns/iter1.6154537718296222
ns/iter0.80
JSON_String_Key_Hash/100
1.2896538841244762
ns/iter1.5603951017198325
ns/iter0.83
JSON_Object_Defines_Miss_Same_Length
2.287600009309206
ns/iter3.362106144132075
ns/iter0.68
JSON_Object_Defines_Miss_Too_Small
2.275607210305608
ns/iter3.7994952091358773
ns/iter0.60
JSON_Object_Defines_Miss_Too_Large
2.2741525298034553
ns/iter3.356597850615517
ns/iter0.68
Pointer_Object_Traverse
15.91208619025048
ns/iter19.75359273571819
ns/iter0.81
Pointer_Object_Try_Traverse
22.735927749874488
ns/iter31.31476993332508
ns/iter0.73
Pointer_Push_Back_Pointer_To_Weak_Pointer
178.25866034002152
ns/iter215.76314284934492
ns/iter0.83
This comment was automatically generated by workflow using github-action-benchmark.
201aa7f
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
7.091121651784857
ns/iter6.9144799107156985
ns/iter1.03
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
6.911580357142709
ns/iter6.835208705357079
ns/iter1.01
Regex_Period_Asterisk
7.970574071560875
ns/iter6.9091305803554395
ns/iter1.15
Regex_Group_Period_Asterisk_Group
6.823160714284983
ns/iter7.136781250000215
ns/iter0.96
Regex_Period_Plus
7.2601752232134436
ns/iter7.222527901785521
ns/iter1.01
Regex_Period
7.31007924107122
ns/iter7.321988839285508
ns/iter1.00
Regex_Caret_Period_Plus_Dollar
7.508563616071789
ns/iter7.314254464286003
ns/iter1.03
Regex_Caret_Group_Period_Plus_Group_Dollar
7.521664252136639
ns/iter7.436677455357556
ns/iter1.01
Regex_Caret_Period_Asterisk_Dollar
7.002910714284383
ns/iter7.1376696428591755
ns/iter0.98
Regex_Caret_Group_Period_Asterisk_Group_Dollar
7.318847098213764
ns/iter6.848904017857649
ns/iter1.07
Regex_Caret_X_Hyphen
11.77541250000047
ns/iter14.28854464285629
ns/iter0.82
Regex_Period_Md_Dollar
149.26479910718015
ns/iter147.26102690802892
ns/iter1.01
Regex_Caret_Slash_Period_Asterisk
10.433210714284412
ns/iter10.25467343749753
ns/iter1.02
Regex_Caret_Period_Range_Dollar
7.758664062499523
ns/iter7.46314620535823
ns/iter1.04
Regex_Nested_Backtrack
619.3226000000323
ns/iter616.5362499999105
ns/iter1.00
JSON_Array_Of_Objects_Unique
449.9729419715434
ns/iter450.03243079498725
ns/iter1.00
JSON_Parse_1
80649.46428572029
ns/iter80977.25446428885
ns/iter1.00
JSON_Fast_Hash_Helm_Chart_Lock
64.96771428570825
ns/iter66.3701562499952
ns/iter0.98
JSON_Equality_Helm_Chart_Lock
195.79995554466467
ns/iter199.81075891162672
ns/iter0.98
JSON_String_Equal/10
9.618754687497955
ns/iter9.61345977851132
ns/iter1.00
JSON_String_Equal/100
9.929729419958315
ns/iter9.930998437496896
ns/iter1.00
JSON_String_Equal_Small_By_Perfect_Hash/10
2.1649428125002146
ns/iter2.1670134375000316
ns/iter1.00
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.891753504948648
ns/iter14.294910714285031
ns/iter1.04
JSON_String_Fast_Hash/10
3.766949993273385
ns/iter3.7161623883922146
ns/iter1.01
JSON_String_Fast_Hash/100
3.8189484889622607
ns/iter3.7196271362156277
ns/iter1.03
JSON_String_Key_Hash/10
7.4698419309396185
ns/iter7.670011160712927
ns/iter0.97
JSON_String_Key_Hash/100
4.023559203614034
ns/iter4.030041792910132
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
3.7155026719371556
ns/iter3.7158753736590584
ns/iter1.00
JSON_Object_Defines_Miss_Too_Small
3.715276064793996
ns/iter3.7211126719266163
ns/iter1.00
JSON_Object_Defines_Miss_Too_Large
4.959134821429449
ns/iter4.959945000000516
ns/iter1.00
Pointer_Object_Traverse
53.213800000003175
ns/iter53.10589285713263
ns/iter1.00
Pointer_Object_Try_Traverse
67.96050892857255
ns/iter68.14814732142135
ns/iter1.00
Pointer_Push_Back_Pointer_To_Weak_Pointer
185.2056326076679
ns/iter162.03533482140082
ns/iter1.14
This comment was automatically generated by workflow using github-action-benchmark.
201aa7f
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
51.14066424997992
ns/iter48.75109909351417
ns/iter1.05
Pointer_Object_Try_Traverse
26.424871923536205
ns/iter26.56489624858617
ns/iter0.99
Pointer_Push_Back_Pointer_To_Weak_Pointer
137.23630778285332
ns/iter137.03136163365616
ns/iter1.00
JSON_Array_Of_Objects_Unique
427.9900838208122
ns/iter427.453791050745
ns/iter1.00
JSON_Parse_1
33600.45239813669
ns/iter34075.01461062306
ns/iter0.99
JSON_Fast_Hash_Helm_Chart_Lock
64.30317698203201
ns/iter69.83548164134409
ns/iter0.92
JSON_Equality_Helm_Chart_Lock
144.02655478799477
ns/iter142.36374623685398
ns/iter1.01
JSON_String_Equal/10
5.993366518707128
ns/iter6.129995759782676
ns/iter0.98
JSON_String_Equal/100
6.6147717345995884
ns/iter6.614445330744855
ns/iter1.00
JSON_String_Equal_Small_By_Perfect_Hash/10
0.6306406366057179
ns/iter0.6240241803090223
ns/iter1.01
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
14.289351790997793
ns/iter14.291537570637741
ns/iter1.00
JSON_String_Fast_Hash/10
0.9345565819037375
ns/iter0.9325220266602526
ns/iter1.00
JSON_String_Fast_Hash/100
0.9353544826598945
ns/iter0.9350672889950257
ns/iter1.00
JSON_String_Key_Hash/10
1.7109630539540488
ns/iter1.7110889918549097
ns/iter1.00
JSON_String_Key_Hash/100
2.0252341595083987
ns/iter2.0241507430891885
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
3.1393019364327253
ns/iter3.1110717272690316
ns/iter1.01
JSON_Object_Defines_Miss_Too_Small
2.7997074499554175
ns/iter2.80074293633738
ns/iter1.00
JSON_Object_Defines_Miss_Too_Large
2.486166177355755
ns/iter2.4900611471436234
ns/iter1.00
Regex_Lower_S_Or_Upper_S_Asterisk
2.7975787798756455
ns/iter2.7997003773469666
ns/iter1.00
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
2.796281646433958
ns/iter2.798182696320189
ns/iter1.00
Regex_Period_Asterisk
2.7957025138950278
ns/iter2.7996558896341583
ns/iter1.00
Regex_Group_Period_Asterisk_Group
2.7969285615114767
ns/iter2.7991121464627104
ns/iter1.00
Regex_Period_Plus
3.4222584691039817
ns/iter3.4195085996782613
ns/iter1.00
Regex_Period
3.4223577536878556
ns/iter3.4220786606799805
ns/iter1.00
Regex_Caret_Period_Plus_Dollar
3.4220506671794313
ns/iter3.4183441034305027
ns/iter1.00
Regex_Caret_Group_Period_Plus_Group_Dollar
3.426832744558921
ns/iter3.4178234744280602
ns/iter1.00
Regex_Caret_Period_Asterisk_Dollar
4.048202533186044
ns/iter4.051101133536011
ns/iter1.00
Regex_Caret_Group_Period_Asterisk_Group_Dollar
4.041709918590532
ns/iter2.7968561552884674
ns/iter1.45
Regex_Caret_X_Hyphen
12.43081945229275
ns/iter12.434128917768048
ns/iter1.00
Regex_Period_Md_Dollar
93.7196440901218
ns/iter93.60875658014514
ns/iter1.00
Regex_Caret_Slash_Period_Asterisk
7.460252722140865
ns/iter6.531980503840249
ns/iter1.14
Regex_Caret_Period_Range_Dollar
4.356012418731185
ns/iter4.35126898512985
ns/iter1.00
Regex_Nested_Backtrack
835.8505635823649
ns/iter824.6474331902422
ns/iter1.01
This comment was automatically generated by workflow using github-action-benchmark.
201aa7f
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
2.0997233744843733
ns/iter2.307258232359736
ns/iter0.91
Regex_Caret_Lower_S_Or_Upper_S_Asterisk_Dollar
1.9997025816170784
ns/iter2.4866142250527155
ns/iter0.80
Regex_Period_Asterisk
2.037572405070126
ns/iter2.2767789947568207
ns/iter0.89
Regex_Group_Period_Asterisk_Group
1.9937948148717874
ns/iter2.4229302688969163
ns/iter0.82
Regex_Period_Plus
1.71721257528561
ns/iter2.040878574220909
ns/iter0.84
Regex_Period
1.6495946102669918
ns/iter2.078585156732602
ns/iter0.79
Regex_Caret_Period_Plus_Dollar
1.7341295694495507
ns/iter2.19364977944299
ns/iter0.79
Regex_Caret_Group_Period_Plus_Group_Dollar
1.7131398472052586
ns/iter2.0439360119887415
ns/iter0.84
Regex_Caret_Period_Asterisk_Dollar
1.9609254690194118
ns/iter2.3498742847739904
ns/iter0.83
Regex_Caret_Group_Period_Asterisk_Group_Dollar
1.9763751316555198
ns/iter2.3729913248092065
ns/iter0.83
Regex_Caret_X_Hyphen
6.22681874093665
ns/iter7.046598025094817
ns/iter0.88
Regex_Period_Md_Dollar
71.4976132691297
ns/iter92.40012184451756
ns/iter0.77
Regex_Caret_Slash_Period_Asterisk
4.5333822596208035
ns/iter5.31504060787908
ns/iter0.85
Regex_Caret_Period_Range_Dollar
1.9582673309738345
ns/iter2.1873454382733284
ns/iter0.90
Regex_Nested_Backtrack
862.0038491563802
ns/iter960.6516415210623
ns/iter0.90
JSON_Array_Of_Objects_Unique
223.04024033651106
ns/iter270.466393366361
ns/iter0.82
JSON_Parse_1
23918.782365417377
ns/iter27834.316547057537
ns/iter0.86
JSON_Fast_Hash_Helm_Chart_Lock
24.411455840521562
ns/iter27.95184948868726
ns/iter0.87
JSON_Equality_Helm_Chart_Lock
114.03907602525355
ns/iter130.00838687250172
ns/iter0.88
JSON_String_Equal/10
5.413220559822155
ns/iter6.298982865014246
ns/iter0.86
JSON_String_Equal/100
5.202780959831564
ns/iter6.0395776497263025
ns/iter0.86
JSON_String_Equal_Small_By_Perfect_Hash/10
1.007450230581849
ns/iter0.859495210246331
ns/iter1.17
JSON_String_Equal_Small_By_Runtime_Perfect_Hash/10
3.7084341867976187
ns/iter4.30433869616401
ns/iter0.86
JSON_String_Fast_Hash/10
2.04986263167727
ns/iter2.0534331171553513
ns/iter1.00
JSON_String_Fast_Hash/100
1.952228368117017
ns/iter2.050799404781123
ns/iter0.95
JSON_String_Key_Hash/10
1.500697532648391
ns/iter1.5785908978959966
ns/iter0.95
JSON_String_Key_Hash/100
2.0609974353162768
ns/iter2.065165559893803
ns/iter1.00
JSON_Object_Defines_Miss_Same_Length
1.8184828903555086
ns/iter2.0133791856408787
ns/iter0.90
JSON_Object_Defines_Miss_Too_Small
1.9797001760151622
ns/iter2.1063131093744354
ns/iter0.94
JSON_Object_Defines_Miss_Too_Large
1.8208825179166015
ns/iter1.941167571837577
ns/iter0.94
Pointer_Object_Traverse
54.29158947767602
ns/iter63.42998870938045
ns/iter0.86
Pointer_Object_Try_Traverse
37.24810639208389
ns/iter41.46197372249117
ns/iter0.90
Pointer_Push_Back_Pointer_To_Weak_Pointer
172.56268673752015
ns/iter189.52957310522316
ns/iter0.91
This comment was automatically generated by workflow using github-action-benchmark.