Move copying out of tight loop
This commit is contained in:
@@ -327,14 +327,27 @@ inline Status n_string(Parser3 *self) {
|
||||
}
|
||||
|
||||
inline Status n_string2(Parser3 *self) {
|
||||
auto commit = [self, before = self->buf]() {
|
||||
int len = self->buf - before;
|
||||
if (self->writeBuf != before) {
|
||||
memmove(self->writeBuf, before, len);
|
||||
}
|
||||
self->writeBuf += len;
|
||||
};
|
||||
begin:
|
||||
switch (tables.stringByteMeaning[uint8_t(*self->buf)]) {
|
||||
case Tables::NORMAL:
|
||||
*self->writeBuf++ = *self->buf++;
|
||||
auto meaning = tables.stringByteMeaning[uint8_t(*self->buf)];
|
||||
if (meaning == Tables::NORMAL) {
|
||||
++self->buf;
|
||||
if (self->buf == self->bufEnd) {
|
||||
commit();
|
||||
MUSTTAIL return Parser3::keepGoing(self);
|
||||
}
|
||||
goto begin;
|
||||
}
|
||||
commit();
|
||||
switch (meaning) {
|
||||
case Tables::NORMAL:
|
||||
__builtin_unreachable();
|
||||
case Tables::DUBQUOTE:
|
||||
self->flushString();
|
||||
self->callbacks->on_end_string(self->data);
|
||||
|
||||
Reference in New Issue
Block a user