Avoid Utf8Dfa scan if there's no non-ascii

This commit is contained in:
2025-08-15 19:45:00 -04:00
parent 0b24636c4f
commit c303478ad7

View File

@@ -209,6 +209,7 @@ inline PRESERVE_NONE WeaselJsonStatus scan_string_impl(Parser3 *self,
if (self->strDfa.accept()) {
for (;;) {
if (bufEnd - buf < V::lanes) [[unlikely]] {
buf = (char *)self->strDfa.scan(buf, bufEnd);
break;
}
auto v = V{(int8_t *)buf};
@@ -217,13 +218,16 @@ inline PRESERVE_NONE WeaselJsonStatus scan_string_impl(Parser3 *self,
.count_leading_nonzero_lanes();
buf += normal;
if (normal < V::lanes) {
if (buf != bufEnd && *buf < 0x20) {
buf = (char *)self->strDfa.scan(buf, bufEnd);
}
break;
}
}
} else {
buf = (char *)self->strDfa.scan(buf, bufEnd);
}
buf = (char *)self->strDfa.scan(buf, bufEnd);
int len = buf - before;
if (!(self->flags & WeaselJsonRaw)) {
if (self->writeBuf != before) {