Skip to content

Commit 381eb55

Browse files
committed
Testing new fallback layer for simd.
1 parent 66e2221 commit 381eb55

7 files changed

Lines changed: 282 additions & 216 deletions

File tree

Benchmarks/tests.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#pragma once
2424

2525
#include "jsonifier.hpp"
26+
#include "simdjson.hpp"
2627
#include "glaze.hpp"
2728

2829
namespace tests {
@@ -605,7 +606,7 @@ namespace tests {
605606
return r;
606607
}
607608
};
608-
/*
609+
609610
template<pod_type test_data_type, bool minified, size_t iterations, const bnch_swt::string_literal test_name_new>
610611
struct json_test_helper<json_library::simdjson, test_type::parse_and_serialize, test_data_type, minified, iterations, test_name_new> {
611612
JSONIFIER_INLINE static auto run(const test_data_type& test_data_new) {
@@ -776,7 +777,7 @@ namespace tests {
776777
return r;
777778
}
778779
};
779-
*/
780+
780781
#if JSONIFIER_PLATFORM_MAC
781782
constexpr bnch_swt::string_literal table_header = bnch_swt::string_literal{
782783
R"(
@@ -868,7 +869,7 @@ In contrast, hash-based solutions offer a viable alternative by circumventing th
868869
results_data glaze_results{};
869870

870871
#if !defined(ASAN_ENABLED)
871-
//simdjson_results = json_test_helper<json_library::simdjson, type, test_data_type, minified, iterations, test_name>::run(json_data_new);
872+
simdjson_results = json_test_helper<json_library::simdjson, type, test_data_type, minified, iterations, test_name>::run(json_data_new);
872873
if constexpr (!std::is_same_v<test_data_type, partial_test<partial_test_struct>> && !std::is_same_v<test_data_type, twitter_partial_message>) {
873874
glaze_results = json_test_helper<json_library::glaze, type, test_data_type, minified, iterations, test_name>::run(json_data_new);
874875
json_results.results.emplace_back(glaze_results);
@@ -934,7 +935,7 @@ In contrast, hash-based solutions offer a viable alternative by circumventing th
934935
results_data simdjson_results{};
935936
results_data glaze_results{};
936937
#if !defined(ASAN_ENABLED)
937-
//simdjson_results = json_test_helper<json_library::simdjson, test_type::minify, std::string, false, iterations, test_name>::run(json_data_new);
938+
simdjson_results = json_test_helper<json_library::simdjson, test_type::minify, std::string, false, iterations, test_name>::run(json_data_new);
938939
glaze_results = json_test_helper<json_library::glaze, test_type::minify, std::string, false, iterations, test_name>::run(json_data_new);
939940
#endif
940941
jsonifier_results = json_test_helper<json_library::jsonifier, test_type::minify, std::string, false, iterations, test_name>::run(json_data_new);

CMake/JsonifierDetectArchitecture.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ math(EXPR INSTRUCTION_PRESENT512 "( ${JSONIFIER_CPU_INSTRUCTIONS_NUMERIC} & 0x40
7171
if(INSTRUCTION_PRESENT512)
7272
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 6" OUTPUT_FORMAT DECIMAL)
7373
elseif(INSTRUCTION_PRESENT256)
74-
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 5" OUTPUT_FORMAT DECIMAL)
74+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 0" OUTPUT_FORMAT DECIMAL)
7575
elseif(INSTRUCTION_PRESENT128)
7676
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 4" OUTPUT_FORMAT DECIMAL)
7777
endif()

Include/jsonifier/Containers/Tuple.hpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,6 @@ namespace jsonifier::internal {
189189
}
190190
};
191191

192-
enum class operation_types {
193-
eq,
194-
neq,
195-
ss,
196-
lt,
197-
lte,
198-
gt,
199-
gte,
200-
};
201-
202192
template<typename index_sequence, typename operation_type> struct comparison_op;
203193

204194
template<uint64_t... indices> struct comparison_op<std::integer_sequence<uint64_t, indices...>, eq_op> {
@@ -403,7 +393,7 @@ namespace jsonifier::internal {
403393
using result_type = join_tuples_t<list_types...>;
404394
using lists_tuple_type = type_list_t<list_types*...>;
405395

406-
static consteval uint64_t get_map_values() {
396+
static consteval auto get_map_values() {
407397
if constexpr (total > 0) {
408398
struct tuple_cat_index_map {
409399
uint64_t list_idx[total]{};
@@ -420,14 +410,14 @@ namespace jsonifier::internal {
420410
return m;
421411
} else {
422412
struct tuple_cat_index_map {
423-
uint64_t list_idx[1]{};
424-
uint64_t local_idx[1]{};
413+
uint64_t list_idx[2]{};
414+
uint64_t local_idx[2]{};
425415
};
426-
return 0ULL;
416+
return tuple_cat_index_map{};
427417
}
428418
}
429419

430-
static constexpr uint64_t map{ get_map_values() };
420+
static constexpr auto map{ get_map_values() };
431421

432422
template<uint64_t index, typename list_type> JSONIFIER_INLINE static constexpr decltype(auto) get_individual_element(list_type&& list) {
433423
auto* tuple_ptr = list[tag<map.list_idx[index]>{}];

0 commit comments

Comments
 (0)