Merge branch develop into claude/perf-iterator-ranges
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
46 files changed
+18656
-15456
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -316,6 +316,30 @@ JSON_HEDLEY_ALWAYS_INLINE std::size_t accumulate_digits(const char* data, std::s
|
||||
return i;
|
||||
}
|
||||
|
||||
/// the index of the first byte at or after @a i that is not a digit: the
|
||||
/// digits of accumulate_digits() without their value
|
||||
JSON_HEDLEY_ALWAYS_INLINE std::size_t skip_digits(const char* data, std::size_t i, std::size_t avail) noexcept
|
||||
{
|
||||
while (avail - i >= 8)
|
||||
{
|
||||
if (!is_eight_digits(read_eight_bytes(data + i)))
|
||||
{
|
||||
// a byte of the word is not a digit: no bounds checks before it
|
||||
while (static_cast<unsigned char>(data[i] - '0') <= 9)
|
||||
{
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
i += 8;
|
||||
}
|
||||
while (i < avail && data[i] >= '0' && data[i] <= '9')
|
||||
{
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/// whether [first, last) contains a digit other than '0'; a plain loop, as
|
||||
/// GCC calls std::any_of out of line even for the usual empty range
|
||||
JSON_HEDLEY_ALWAYS_INLINE bool has_nonzero_digit(const char* first, const char* last) noexcept
|
||||
|
||||
@@ -520,7 +520,10 @@ JSON_HEDLEY_NEVER_INLINE inline std::size_t string_bulk_run_from(const unsigned
|
||||
}
|
||||
#endif
|
||||
|
||||
// string_bulk_run() for the lexer. With NEON, only the first four words are
|
||||
// string_bulk_run() for the lexer. The run must be the longest one: the lexer
|
||||
// would only lose speed with a shorter run, but contiguous_parser rejects a
|
||||
// string whose run ends at a byte other than a quote or a backslash, so a
|
||||
// shorter run would reject valid input there. With NEON, only the first four words are
|
||||
// checked inline (most keys and short values end there), and longer runs and
|
||||
// non-ASCII text continue out of line. The lexer's scan function runs once per
|
||||
// token, and the vector code inlined into it needs more registers, which every
|
||||
|
||||
Reference in new issue
Block a user