perf: monch 0.6#33643
Conversation
fibibot
left a comment
There was a problem hiding this comment.
LGTM. Bumps monch to 0.6 + deno_task_shell to 0.30 and switches five parser sites from char-level scans to byte-level take_while_byte / skip_while_byte where the delimiters are ASCII:
libs/npm/lib.rs:158–166—parse_versionon_(ASCII)libs/npmrc/ini.rs:78–80—parse_section_headeron],\nlibs/npmrc/ini.rs:246—skip_non_newline_whitespaceon,\tlibs/npmrc/ini.rs:255—skip_commenton\nlibs/npmrc/lib.rs:303—env_varon}
Soundness check
Every delimiter byte the new code scans for (_, ], \n, , \t, }) is in the ASCII range 0x00–0x7F, which means it can never appear as a UTF-8 continuation byte (those are 0x80–0xBF). So a byte-level scan that stops at one of these bytes always halts on a valid char boundary, and the returned &str slice is guaranteed valid UTF-8 because the input &str already is. The comments at the relevant sites ("_ is ASCII so the byte-level scan halts on a valid char boundary", etc.) capture this correctly.
The if_not_empty(substring(skip_while(...))) → take_while_byte(...) + empty check rewrite at parse_version is a behavior-preserving simplification — same semantics with one less intermediate combinator.
CI
All 63 of the relevant lint debug / test unit / test node_compat shards across 4 platforms × debug+release are SUCCESS. The 35 CANCELLED jobs and the lone ci status: FAILURE are downstream of an earlier-run cancellation cascade, not actual test failures — re-trigger cleans them up. 134 total green.
Small integration perf win as advertised in the PR body ("like a percent or two") plus the cleanup at libs/npm/lib.rs removing the // todo: improve monch to provide the error message without source TODO comment alongside the version bump.
deno_ast 0.53.2 now includes the error type name ("SyntaxError:") in
parse error messages. The previous fix commit updated the snippet
format but missed the SyntaxError: prefix on the first line of these
three .out files.
In integration this is a very small improvement (like a percent or two).