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
diff --git a/example/jsonptr/jsonptr.cc b/example/jsonptr/jsonptr.cc
index baa03b1..b355a10 100644
--- a/example/jsonptr/jsonptr.cc
+++ b/example/jsonptr/jsonptr.cc
@@ -1222,15 +1222,11 @@
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