Skip to content

Commit 5cb79df

Browse files
committed
Jsonifier Release v0.9.91
* Removed store and storeu functions from being class-contained to free-standing. * Removed unnecessary branch statements from serialize_impl functions. * Improved some of the preprocessor macros for setting architecture. * Replaced a function that uses intrinsics with a non-intrinsic (but more rapid) version. * Renamed parsestring to parseString,. * Fixed a heap-buffer-overflow issue on two of the comparison functions. * Added more implementation to the raw_json_data class. * Added a dedicated concepts namespace. * Added some string-to-number functions. * Split the parseNumber function into multiple specializations to improve performance. * Refactored the jsonifier_object_t and jsonifier_array_t related functions. * Refactored the AVX-types into a statically-operating class instead of a containing one, to improve performance. * Renamed a bunch of things. * Added the structural_index_vector and buffer_string classes for parsing performance. * Improved error output - for debugging the indices. * Implemented new serialization logic for strings. * New subtraction logic. * Reorganized some of the headers.
1 parent f7d0fc4 commit 5cb79df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+6225
-6706
lines changed

.github/workflows/CLANG_18-Ubuntu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Configure CMake
3131
working-directory: ./
3232
run: |
33-
cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=/usr/bin/clang++-18 -DDEV=true -DJSONIFIER_TEST=true
33+
cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=/usr/bin/clang++-18 -DDEV="TRUE" -DJSONIFIER_TEST=true
3434
3535
- name: Build the Test
3636
working-directory: ./Build

.github/workflows/GCC_13-MacOS.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
working-directory: ./
2929
run: |
3030
31-
cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc@13/bin/g++-13 -DDEV=true -DJSONIFIER_TEST=true
31+
cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_COMPILER=/usr/local/opt/gcc@13/bin/g++-13 -DDEV="TRUE" -DJSONIFIER_TEST=true
3232
3333
- name: Build the Test
3434
working-directory: ./Build

.github/workflows/MSVC_2022-Windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Configure CMake
3030
working-directory: ./
3131
run: |
32-
cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DDEV=true -DJSONIFIER_TEST=true
32+
cmake -S . -B ./Build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DDEV="TRUE" -DJSONIFIER_TEST=true
3333
3434
- name: Build the Test
3535
working-directory: ./Build

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Documentation/docs
77
Install/
88
DetectArchitecture.exe
99
DetectArchitecture.obj
10+
JsonData.json

BuildTools/Classes/Packager/Vcpkg.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,4 @@ function secondBuild(string $portFileContent): bool
264264

265265
return $resultCode == 0;
266266
}
267-
};
267+
};

BuildTools/Vendor/Composer/ClassLoader.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ class ClassLoader
4848
// PSR-4
4949
/**
5050
* @var array[]
51-
* @psalm-var array<string, array<string, int>>
51+
* @psalm-var array<string, array<string, int32_t>>
5252
*/
5353
private $prefixLengthsPsr4 = array();
5454
/**
5555
* @var array[]
56-
* @psalm-var array<string, array<int, string>>
56+
* @psalm-var array<string, array<int32_t, string>>
5757
*/
5858
private $prefixDirsPsr4 = array();
5959
/**
@@ -122,7 +122,7 @@ public function getPrefixes()
122122

123123
/**
124124
* @return array[]
125-
* @psalm-return array<string, array<int, string>>
125+
* @psalm-return array<string, array<int32_t, string>>
126126
*/
127127
public function getPrefixesPsr4()
128128
{

CMake/JsonifierDetectArchitecture.cmake

+15-10
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,25 @@ function(jsonifier_check_instruction_set INSTRUCTION_SET_NAME INSTRUCTION_SET_IN
4747
endif()
4848
endfunction()
4949

50-
set(INSTRUCTION_SET_NAMES "POPCNT" "LZCNT" "BMI" "AVX" "AVX2" "AVX512")
50+
set(INSTRUCTION_SET_NAMES "POPCNT" "LZCNT" "BMI" "BMI2" "AVX" "AVX2" "AVX512")
5151
set (INSTRUCTION_SET_CODE
5252
"auto result = _mm_popcnt_u64(uint64_t{})"
5353
"auto result = _lzcnt_u64(int64_t{})"
54-
"auto result = _blsr_u64(uint64_t{})"
54+
"auto result = _blsr_u64(uint64_t{}).result = _tzcnt_u32(uint16_t{})"
55+
"auto result = _pdep_u64(uint64_t{}, uint64_t{})"
5556
"auto result = _mm_castsi128_pd(__m128i{}).auto result02 = _mm_setzero_si128()"
5657
"auto result = _mm256_add_epi32(__m256i{}, __m256i{})"
5758
"auto result = _mm512_add_ps(__m512i{}, __m512i{}).auto result2 = _mm512_cmplt_epu8_mask(__m512i{}, __m512i{}).auto result03 = _mm_abs_epi64 (__m128i{})"
5859
)
5960

60-
set(INDEX_SET "0" "1" "2" "3" "4" "5")
61+
set(INDEX_SET "0" "1" "2" "3" "4" "5" "6")
6162

6263
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
63-
set(INSTRUCTION_SET_IN_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
64-
set(INSTRUCTION_SET_OUT_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
64+
set(INSTRUCTION_SET_IN_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
65+
set(INSTRUCTION_SET_OUT_FLAGS "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX" "/arch:AVX2" "/arch:AVX512")
6566
else()
66-
set(INSTRUCTION_SET_IN_FLAGS "-march=native" "-march=native" "-march=native" "-march=native" "-march=native" "-march=native")
67-
set(INSTRUCTION_SET_OUT_FLAGS "-mpopcnt" "-mlzcnt" "-mbmi" "-mavx.-mpclmul" "-mavx2.-mpclmul" "-mavx512f.-mavx512bw.-mavx512vl.-mpclmul")
67+
set(INSTRUCTION_SET_IN_FLAGS "-march=native" "-march=native" "-march=native" "-march=native" "-march=native" "-march=native" "-march=native")
68+
set(INSTRUCTION_SET_OUT_FLAGS "-mpopcnt" "-mlzcnt" "-mbmi" "-mbmi2" "-mavx.-mpclmul" "-mavx2.-mpclmul" "-mavx512f.-mavx512bw.-mavx512vl.-mpclmul")
6869
endif()
6970

7071
set(CMAKE_REQUIRED_FLAGS_SAVE "${CMAKE_REQUIRED_FLAGS}")
@@ -101,15 +102,19 @@ if (NOT "${BMI}" STREQUAL "")
101102
list(APPEND AVX_FLAG "${BMI}")
102103
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 2" OUTPUT_FORMAT DECIMAL)
103104
endif()
105+
if (NOT "${BMI2}" STREQUAL "")
106+
list(APPEND AVX_FLAG "${BMI2}")
107+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 3" OUTPUT_FORMAT DECIMAL)
108+
endif()
104109
if (NOT "${AVX512}" STREQUAL "")
105110
list(APPEND AVX_FLAG "${AVX512}")
106-
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 5" OUTPUT_FORMAT DECIMAL)
111+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 6" OUTPUT_FORMAT DECIMAL)
107112
elseif (NOT "${AVX2}" STREQUAL "")
108113
list(APPEND AVX_FLAG "${AVX2}")
109-
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 4" OUTPUT_FORMAT DECIMAL)
114+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 5" OUTPUT_FORMAT DECIMAL)
110115
elseif (NOT "${AVX}" STREQUAL "")
111116
list(APPEND AVX_FLAG "${AVX}")
112-
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 3" OUTPUT_FORMAT DECIMAL)
117+
math(EXPR JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS} | 1 << 4" OUTPUT_FORMAT DECIMAL)
113118
endif()
114119

115120
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_SAVE}")

CMakeLists.txt

+8-21
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/CMake;")
2929
include("CollectVersion")
3030
collect_version("jsonifier")
3131

32-
set(PROJECT_NAME "Jsonifier")
32+
set(PROJECT_NAME "Jsonifier")
3333
set(PRODUCT_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
3434

3535
project(
36-
"${PROJECT_NAME}"
37-
VERSION "${PRODUCT_VERSION}"
38-
LANGUAGES CXX
36+
"${PROJECT_NAME}"
37+
VERSION "${PRODUCT_VERSION}"
38+
LANGUAGES CXX
3939
)
4040

4141
set(CMAKE_CXX_STANDARD 20)
@@ -49,6 +49,7 @@ file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/Include
4949
set(JSONIFIER-POPCNT_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
5050
set(JSONIFIER-LZCNT_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
5151
set(JSONIFIER-BMI_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
52+
set(JSONIFIER-BMI2_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
5253
set(JSONIFIER-AVX_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
5354
set(JSONIFIER-AVX2_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
5455
set(JSONIFIER-AVX512_EXITCODE 0 CACHE INTERNAL "For cross-compiling.")
@@ -62,6 +63,7 @@ set_target_properties(
6263
OUTPUT_NAME "jsonifier"
6364
CXX_STANDARD_REQUIRED ON
6465
CXX_EXTENSIONS OFF
66+
PUBLIC_HEADER "${HEADERS}"
6567
)
6668

6769
target_include_directories(
@@ -72,6 +74,7 @@ target_include_directories(
7274
target_compile_definitions(
7375
"${PROJECT_NAME}" INTERFACE
7476
"JSONIFIER_CPU_INSTRUCTIONS=${JSONIFIER_CPU_INSTRUCTIONS}"
77+
"$<$<STREQUAL:${DEV},TRUE>:DEV>"
7578
)
7679

7780
set(JSONIFIER_CPU_INSTRUCTIONS "${JSONIFIER_CPU_INSTRUCTIONS}" CACHE INTERNAL "For the CPU architecture selection.")
@@ -80,26 +83,10 @@ set(AVX_FLAG "${AVX_FLAG}" CACHE INTERNAL "For the CPU flag selection.")
8083
target_compile_options(
8184
"${PROJECT_NAME}" INTERFACE
8285
"$<$<CXX_COMPILER_ID:MSVC>:$<$<STREQUAL:${ASAN_ENABLED},TRUE>:/fsanitize=address>>"
83-
"$<$<CXX_COMPILER_ID:MSVC>:$<$<STREQUAL:${ASAN_ENABLED},TRUE>:/EHsc>>"
84-
"$<$<CXX_COMPILER_ID:MSVC>:/Zc:preprocessor>"
85-
"$<$<CXX_COMPILER_ID:MSVC>:/permissive->"
86-
"$<$<CXX_COMPILER_ID:CLANG>:-pedantic>"
87-
"$<$<CXX_COMPILER_ID:MSVC>:/Zc:lambda>"
88-
"$<$<CXX_COMPILER_ID:GNU>:-pedantic>"
89-
"$<$<CXX_COMPILER_ID:CLANG>:-Wextra>"
90-
"$<$<CXX_COMPILER_ID:CLANG>:-Wall>"
91-
"$<$<CXX_COMPILER_ID:GNU>:-Wextra>"
92-
"$<$<CXX_COMPILER_ID:GNU>:-Wall>"
93-
"$<$<CXX_COMPILER_ID:MSVC>:/GL>"
94-
"$<$<CXX_COMPILER_ID:MSVC>:/W4>"
86+
"$<$<CXX_COMPILER_ID:MSVC>:/MP${THREAD_COUNT}>"
9587
"${AVX_FLAG}"
9688
)
9789

98-
target_link_options(
99-
"${PROJECT_NAME}" INTERFACE
100-
"$<$<CXX_COMPILER_ID:GNU>:$<$<STREQUAL:${ASAN_ENABLED},TRUE>:-fsanitize=address>>"
101-
)
102-
10390
set(CONFIG_FILE_NAME "${PROJECT_NAME}Config.cmake")
10491
set(EXPORTED_TARGETS_NAME "${PROJECT_NAME}Targets")
10592
set(EXPORTED_TARGETS_FILE_NAME "${EXPORTED_TARGETS_NAME}.cmake")

0 commit comments

Comments
 (0)