The characters between two escapes (a quote, a backslash, a control
character) are copied to the write buffer by memcpy with a length known only
at run time. For a run of up to 16 characters that has 16 or more bytes in
the string behind its start and in the buffer behind its end, a copy of a
fixed block of 16 bytes does the same without the call; the surplus bytes in
the buffer are overwritten by what follows.
Apple M1, Apple clang, retired instructions per dump(), on top of the
previous changes:
JSON in JSON 8.32M -> 7.52M (-10 %) paths 8.17M -> 7.49M (-8 %)
log lines 7.49M -> 7.14M (-5 %) cjk, emoji text (no escapes): +-1 %
Linux x86-64 (callgrind), gcc 13 / clang 18:
JSON in JSON -11 % / -10 %, paths -7 % / -6 %, log lines -5 % / -4 %.
The branch is marked unlikely: text without escapes (CJK, accented Latin)
has few short runs, and without the hint it paid up to 5 % for the check.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>