Optimize compile-time performance with loop constant hoisting and improved memory access patterns #21
+28
−22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors internal string parsing logic in the Enchantum library to improve code clarity and maintainability across all supported compilers (Clang, GCC, and MSVC). The main changes involve introducing named constants for skip lengths after commas, and simplifying string copying logic in data structures. These changes are applied consistently in both the main library and the single-header distribution.
String parsing and copying improvements:
Introduced named constants (
skip_after_comma
,skip_comma
) to replace repeated inline expressions for skipping over commas in string parsing logic, making the code clearer and reducing the risk of mistakes. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]Refactored string copying in data structures to use a source pointer (
src_string
) and a single for-loop with an explicit size variable, improving readability and consistency. [1] [2] [3] [4]These changes are mirrored in the single-header version to ensure consistency between the header-only and multi-file builds.