261020.1 · 852c4d609611d1177de832010ff2de810ef026c8
Improve performance of UTF-8 validation (#3675)
jvp_utf8_next() had a fast path for ASCII, but it is not inlined into its callers, so every byte of a string cost a function call.
Move the end check and the ASCII case into a static inline function in jv_unicode.h and keep the rest out of line. This speeds up parsing of string-heavy input by up to 1.17x and string functions such as length, explode and @html, with the same output for every input.
reading declarations
Changes to src/jv_parse.c. All files
@@ -784,9 +784,10 @@ jv jv_parser_next(struct jv_parser* p) { } else if (msg) { jv_free(value); if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) {- // Skip to the next RS value = make_error(p, "%s at line %d, column %d (need RS to resync)", msg, p->line, p->column); parser_reset(p);+ // Skip to the next RS. This must come after parser_reset(), which+ // sets the state back to JV_PARSER_NORMAL. p->st = JV_PARSER_WAITING_FOR_RS; return value; }