@@ -96,7 +96,7 @@ namespace tests {
96
96
static constexpr bnch_swt::string_literal testNameRead{ testName + " -Read-Raw-Json-Data" };
97
97
static constexpr bnch_swt::string_literal testNameWrite{ testName + " -Write-Raw-Json-Data" };
98
98
static constexpr bool partialRead{ std::is_same_v<test_data_type, partial_test<partial_test_struct>> || std::is_same_v<test_data_type, twitter_partial_message> };
99
- static constexpr bool knownOrder{ !std::is_same_v<test_data_type, twitter_partial_message> && !std::is_same_v<test_data_type, abc_test<abc_test_struct>> };
99
+ static constexpr bool knownOrder{ true };
100
100
std::vector<std::string> newStrings{ iterations };
101
101
results_data r{ jsonifierLibraryName, testName, jsonifierCommitUrl };
102
102
jsonifier::jsonifier_core parser{};
@@ -166,7 +166,7 @@ namespace tests {
166
166
static constexpr bnch_swt::string_literal testNameRead{ testName + " -Read" };
167
167
static constexpr bnch_swt::string_literal testNameWrite{ testName + " -Write" };
168
168
static constexpr bool partialRead{ std::is_same_v<test_data_type, partial_test<partial_test_struct>> || std::is_same_v<test_data_type, twitter_partial_message> };
169
- static constexpr bool knownOrder{ !std::is_same_v<test_data_type, twitter_partial_message> && !std::is_same_v<test_data_type, abc_test<abc_test_struct>> };
169
+ static constexpr bool knownOrder{ true };
170
170
results_data r{ jsonifierLibraryName, testName, jsonifierCommitUrl };
171
171
jsonifier::jsonifier_core parser{};
172
172
std::vector<std::vector<std::string>> newStrings{ iterations };
@@ -217,7 +217,7 @@ namespace tests {
217
217
});
218
218
r.readResult = result<result_type::read>{ " teal" , readResult };
219
219
r.writeResult = result<result_type::write>{ " steelblue" , writeResult };
220
- bnch_swt::file_loader::saveFile (static_cast <std::string>(parser.serializeJson (testDatas[ 0 ] )),
220
+ bnch_swt::file_loader::saveFile (static_cast <std::string>(parser.serializeJson (testDatas)),
221
221
jsonOutPath.operator std::string () + " /" + testName.operator std::string () + " -jsonifier.json" );
222
222
return r;
223
223
}
@@ -230,7 +230,7 @@ namespace tests {
230
230
static constexpr bnch_swt::string_literal testNameRead{ testName + " -Read" };
231
231
static constexpr bnch_swt::string_literal testNameWrite{ testName + " -Write" };
232
232
static constexpr bool partialRead{ std::is_same_v<test_data_type, partial_test<partial_test_struct>> || std::is_same_v<test_data_type, twitter_partial_message> };
233
- static constexpr bool knownOrder{ !std::is_same_v<test_data_type, twitter_partial_message> && !std::is_same_v<test_data_type, abc_test<abc_test_struct>> };
233
+ static constexpr bool knownOrder{ true };
234
234
results_data r{ jsonifierLibraryName, testName, jsonifierCommitUrl };
235
235
jsonifier::jsonifier_core parser{};
236
236
std::vector<std::string> newStrings{ iterations };
@@ -278,7 +278,7 @@ namespace tests {
278
278
static constexpr bnch_swt::string_literal testNameRead{ testName + " -Read" };
279
279
static constexpr bnch_swt::string_literal testNameWrite{ testName + " -Write" };
280
280
static constexpr bool partialRead{ std::is_same_v<test_data_type, partial_test<partial_test_struct>> || std::is_same_v<test_data_type, twitter_partial_message> };
281
- static constexpr bool knownOrder{ !std::is_same_v<test_data_type, twitter_partial_message> && !std::is_same_v<test_data_type, abc_test<abc_test_struct>> };
281
+ static constexpr bool knownOrder{ true };
282
282
results_data r{ jsonifierLibraryName, testName, jsonifierCommitUrl };
283
283
jsonifier::jsonifier_core parser{};
284
284
std::vector<std::string> newStrings{ iterations };
@@ -422,7 +422,8 @@ namespace tests {
422
422
testDatas[x].resize (testDataNew[x].size ());
423
423
}
424
424
size_t currentIndex{};
425
- bnch_swt::performance_metrics readResult = bnch_swt::benchmark_stage<testNameRead, iterations, measuredIterations>::template runBenchmark<glazeLibraryName, " teal" >([&]() mutable {
425
+ bnch_swt::performance_metrics readResult =
426
+ bnch_swt::benchmark_stage<testNameRead, iterations, measuredIterations>::template runBenchmark<glazeLibraryName, " teal" >([&]() mutable {
426
427
size_t newSize{};
427
428
for (size_t x = 0 ; x < testDatas[currentIndex].size (); ++x) {
428
429
get_ref_t <decltype (testDatas[currentIndex][x])> reference = testDatas[currentIndex][x];
@@ -439,7 +440,7 @@ namespace tests {
439
440
}
440
441
++currentIndex;
441
442
return newSize;
442
- });
443
+ });
443
444
for (size_t x = 0 ; x < iterations; ++x) {
444
445
for (size_t y = 0 ; y < testDataNew[x].size (); ++y) {
445
446
newStrings[x][y] = std::string{};
@@ -462,7 +463,7 @@ namespace tests {
462
463
r.readResult = result<result_type::read>{ " dodgerblue" , readResult };
463
464
r.writeResult = result<result_type::write>{ " skyblue" , writeResult };
464
465
std::string newString{};
465
- auto newResult = glz::write_json (testDatas[ 0 ] , newString);
466
+ auto newResult = glz::write_json (testDatas, newString);
466
467
( void )newResult;
467
468
bnch_swt::file_loader::saveFile (newString, jsonOutPath.operator std::string () + " /" + testName.operator std::string () + " -glaze.json" );
468
469
return r;
@@ -669,7 +670,7 @@ namespace tests {
669
670
});
670
671
r.readResult = result<result_type::read>{ " cadetblue" , readResult };
671
672
std::string newString{};
672
- auto newResult = glz::write_json (testDatas[ 0 ] , newString);
673
+ auto newResult = glz::write_json (testDatas, newString);
673
674
( void )newResult;
674
675
bnch_swt::file_loader::saveFile (newString, jsonOutPath.operator std::string () + " /" + testName.operator std::string () + " -simdjson.json" );
675
676
return r;
@@ -994,21 +995,13 @@ In contrast, hash-based solutions offer a viable alternative by circumventing th
994
995
JSONIFIER_CLANG_INLINE void testFunction () {
995
996
std::string jsonDataNew{};
996
997
jsonifier::jsonifier_core parser{};
997
- std::vector<test_struct> jsonDataSmallNewer{ maxIterations };
998
- for (size_t x = 0 ; x < maxIterations; ++x) {
999
- jsonDataSmallNewer[x] = test_generator::generateTestStruct ();
1000
- }
1001
998
std::vector<test<test_struct>> jsonDataNewer{ maxIterations };
1002
999
for (size_t x = 0 ; x < maxIterations; ++x) {
1003
1000
jsonDataNewer[x] = test_generator::generateTest ();
1004
1001
}
1005
- parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(jsonDataSmallNewer[0 ], jsonDataNew);
1006
- bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /Json Test (Small) (Prettified).json" );
1007
- std::string jsonMinifiedData{ parser.minifyJson (jsonDataNew) };
1008
- bnch_swt::file_loader::saveFile (jsonMinifiedData, jsonOutPath.operator std::string () + " /Json Test (Small) (Minified).json" );
1009
1002
parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(jsonDataNewer[0 ], jsonDataNew);
1010
1003
bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /Json Test (Prettified).json" );
1011
- jsonMinifiedData = parser.minifyJson (jsonDataNew);
1004
+ std::string jsonMinifiedData = parser.minifyJson (jsonDataNew);
1012
1005
bnch_swt::file_loader::saveFile (jsonMinifiedData, jsonOutPath.operator std::string () + " /Json Test (Minified).json" );
1013
1006
bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /Partial Test (Prettified).json" );
1014
1007
bnch_swt::file_loader::saveFile (jsonMinifiedData, jsonOutPath.operator std::string () + " /Partial Test (Minified).json" );
@@ -1023,51 +1016,45 @@ In contrast, hash-based solutions offer a viable alternative by circumventing th
1023
1016
static_cast <std::string>(section001) };
1024
1017
test_results testResults{};
1025
1018
{
1026
- std::vector<std::vector<double >> doubleData{ test_generator::generateValues<double >(maxIterations, 2500 ) };
1027
- parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(doubleData[ 0 ] , jsonDataNew);
1019
+ std::vector<std::vector<double >> doubleData{ test_generator::generateValues<double >(maxIterations, 100 ) };
1020
+ parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(doubleData, jsonDataNew);
1028
1021
bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /Double Test.json" );
1029
1022
testResults = json_tests_helper<test_type::parse_and_serialize, std::vector<std::vector<double >>, false , maxIterations, " Double Test" >::run (doubleData);
1030
1023
newerString += testResults.markdownResults ;
1031
1024
benchmark_data.emplace_back (testResults);
1032
1025
}
1033
1026
{
1034
- std::vector<std::vector<std::string>> stringData{ test_generator::generateValues<std::string>(maxIterations, 2500 ) };
1035
- parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(stringData[ 0 ] , jsonDataNew);
1027
+ std::vector<std::vector<std::string>> stringData{ test_generator::generateValues<std::string>(maxIterations, 100 ) };
1028
+ parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(stringData, jsonDataNew);
1036
1029
bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /String Test.json" );
1037
1030
testResults = json_tests_helper<test_type::parse_and_serialize, std::vector<std::vector<std::string>>, false , maxIterations, " String Test" >::run (stringData);
1038
1031
newerString += testResults.markdownResults ;
1039
1032
benchmark_data.emplace_back (testResults);
1040
1033
}
1041
1034
{
1042
- std::vector<std::vector<uint64_t >> uintData{ test_generator::generateValues<uint64_t >(maxIterations, 2500 ) };
1043
- parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(uintData[ 0 ] , jsonDataNew);
1035
+ std::vector<std::vector<uint64_t >> uintData{ test_generator::generateValues<uint64_t >(maxIterations, 100 ) };
1036
+ parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(uintData, jsonDataNew);
1044
1037
bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /Uint Test.json" );
1045
1038
testResults = json_tests_helper<test_type::parse_and_serialize, std::vector<std::vector<uint64_t >>, false , maxIterations, " Uint Test" >::run (uintData);
1046
1039
newerString += testResults.markdownResults ;
1047
1040
benchmark_data.emplace_back (testResults);
1048
1041
}
1049
1042
{
1050
- std::vector<std::vector<int64_t >> intData{ test_generator::generateValues<int64_t >(maxIterations, 2500 ) };
1051
- parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(intData[ 0 ] , jsonDataNew);
1043
+ std::vector<std::vector<int64_t >> intData{ test_generator::generateValues<int64_t >(maxIterations, 100 ) };
1044
+ parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(intData, jsonDataNew);
1052
1045
bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /Int Test.json" );
1053
1046
testResults = json_tests_helper<test_type::parse_and_serialize, std::vector<std::vector<int64_t >>, false , maxIterations, " Int Test" >::run (intData);
1054
1047
newerString += testResults.markdownResults ;
1055
1048
benchmark_data.emplace_back (testResults);
1056
1049
}
1057
1050
{
1058
- std::vector<std::vector<bool >> boolData{ test_generator::generateValues<bool >(maxIterations, 2500 ) };
1059
- parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(boolData[ 0 ] , jsonDataNew);
1051
+ std::vector<std::vector<bool >> boolData{ test_generator::generateValues<bool >(maxIterations, 100 ) };
1052
+ parser.serializeJson <jsonifier::serialize_options{ .prettify = true }>(boolData, jsonDataNew);
1060
1053
bnch_swt::file_loader::saveFile (jsonDataNew, jsonOutPath.operator std::string () + " /Bool Test.json" );
1061
1054
testResults = json_tests_helper<test_type::parse_and_serialize, std::vector<std::vector<bool >>, false , maxIterations, " Bool Test" >::run (boolData);
1062
1055
newerString += testResults.markdownResults ;
1063
1056
benchmark_data.emplace_back (testResults);
1064
1057
}
1065
- testResults = json_tests_helper<test_type::parse_and_serialize, test_struct, false , maxIterations, " Json Test (Small) (Prettified)" >::run (jsonDataSmallNewer);
1066
- newerString += testResults.markdownResults ;
1067
- benchmark_data.emplace_back (testResults);
1068
- testResults = json_tests_helper<test_type::parse_and_serialize, test_struct, true , maxIterations, " Json Test (Small) (Minified)" >::run (jsonDataSmallNewer);
1069
- newerString += testResults.markdownResults ;
1070
- benchmark_data.emplace_back (testResults);
1071
1058
testResults = json_tests_helper<test_type::parse_and_serialize, test<test_struct>, false , maxIterations, " Json Test (Prettified)" >::run (jsonDataNewer);
1072
1059
newerString += testResults.markdownResults ;
1073
1060
benchmark_data.emplace_back (testResults);
0 commit comments