Permalink
Browse files

make better use of out-of-order hardware on the fast string scan

  • Loading branch information...
chadaustin committed Apr 19, 2017
1 parent 806f82f commit 55cc213b526abb49bb6414b946651a9e50f2916f
Showing with 12 additions and 0 deletions.
  1. +12 −0 include/sajson.h
View
@@ -1083,6 +1083,17 @@ namespace sajson {
++p; // "
size_t start = p - input.get_data();
for (;;) {
if (SAJSON_UNLIKELY(input_end - p < 4)) {
goto end_of_buffer;
}
if (!internal::is_plain_string_character(p[0])) { goto found; }
if (!internal::is_plain_string_character(p[1])) { p += 1; goto found; }
if (!internal::is_plain_string_character(p[2])) { p += 2; goto found; }
if (!internal::is_plain_string_character(p[3])) { p += 3; goto found; }
p += 4;
}
end_of_buffer:
for (;;) {
if (SAJSON_UNLIKELY(p >= input_end)) {
p_ = p;
@@ -1096,6 +1107,7 @@ namespace sajson {
++p;
}
found:
if (SAJSON_LIKELY(*p == '"')) {
tag[0] = start;
tag[1] = p - input.get_data();

0 comments on commit 55cc213

Please sign in to comment.