Optimize example/jsonptr token VBD switch

On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.765s
After:
real    0m1.687s
Ratio: 1.05x
This commit is contained in:
Nigel Tao committed 2020-08-21 15:51:48 +10:00
1 parent 592560e0f1
commit 3f688b2677
1 file changed
+3 -7
+3 -7
View File
@@ -1222,15 +1222,11 @@ handle_token(wuffs_base__token t, bool start_of_token_chain) {
TRY(handle_unicode_code_point(vbd));
g_query.incremental_match_code_point(vbd);
return nullptr;
case WUFFS_BASE__TOKEN__VBC__LITERAL:
case WUFFS_BASE__TOKEN__VBC__NUMBER:
TRY(write_dst(tok.ptr, tok.len));
goto after_value;
}
// Return an error if we didn't match the (vbc, vbd) pair.
return "main: internal error: unexpected token";
// We have a literal or a number.
TRY(write_dst(tok.ptr, tok.len));
goto after_value;
} while (0);
// Book-keeping after completing a value (whether a container value or a