Skip to content

Skip regex parse for bare-newline grammar lines - #10

Merged
arpan404 merged 1 commit into
mainfrom
perf/grammar-newline-skip
Nov 1, 2026
Merged

arpan404 merged 1 commit into
mainfrom
perf/grammar-newline-skip

Conversation

@arpan404

Copy link
Copy Markdown
Owner

Bare \n/\r\n past line 0 carries no matchable text: skip the Oniguruma search, replay the line in the current style, keep the boundary. Line 0 always parses (first_line meta scope); whitespace-only lines excluded (trailing-space rules). Blank-rich inputs ~4% faster; dense 200-line fixture within noise (cold +2%, mid-edit +2-4% — fixture has zero bare newlines so the skip never fires there). Outputs byte-identical on 14 adversarial cases; full default + grammars suites green.

Past line 0 a bare newline matches no pattern, so replay it in the
current style with an unchanged boundary instead of running Oniguruma.
Blank-rich inputs measure ~4% faster; dense inputs within noise.
Outputs byte-identical (14 adversarial cases incl. blank lines inside
strings/comments, CRLF, unclosed constructs).

Co-Authored-By: ace <bot@acehq.dev>
@arpan404
arpan404 merged commit cf5b197 into main Nov 1, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant