Skip to content

Skip unicode table lookups for ASCII characters in Char.Extra#278

Merged
jfmengels merged 1 commit intostil4m:masterfrom
dillonkearns:perf/ascii-guard-unicode-check
Apr 3, 2026
Merged

Skip unicode table lookups for ASCII characters in Char.Extra#278
jfmengels merged 1 commit intostil4m:masterfrom
dillonkearns:perf/ascii-guard-unicode-check

Conversation

@dillonkearns
Copy link
Copy Markdown
Contributor

Short-circuit ASCII characters so common terminators like parens, commas, and braces perform 5 checks instead of 10+ checks. Also moves String.fromChar allocation inside unicodeIsLowerFast/unicodeIsUpperFast to reduce GC work.

Benchmarked at 10-26% faster parsing on real-world Elm files.

@jfmengels jfmengels merged commit d71394d into stil4m:master Apr 3, 2026
2 of 3 checks passed
@jfmengels
Copy link
Copy Markdown
Collaborator

Amazing! Thank you very much.
And cc @miniBill who made the original version of this IIRC.

@miniBill
Copy link
Copy Markdown
Contributor

miniBill commented Apr 4, 2026

Good catch! I can probably port back some of this to elm-unicode 🤔

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.

3 participants