Skip to content

perf(inline): linear single-pass check for email autolinks - #14

Merged
SMOSTAFAH1 merged 1 commit into
developfrom
perf/linear-autolink-email
Nov 22, 2026
Merged

SMOSTAFAH1 merged 1 commit into
developfrom
perf/linear-autolink-email

Conversation

@SMOSTAFAH1

Copy link
Copy Markdown
Member

Replace backtracking regular expression with a linear single-pass validation for email autolinks (<user@domain.tld>).

Details:

  • Implement isEmailAutolink with single-pass integer character classification, eliminating quadratic backtracking on a@ followed by repetitive characters.
  • Update scripts/scan-census.json parserInlineMatchers.ts census counts and reasoning.
  • Add test coverage with pathological k=20,000 cases under strict latency bounds and assertion checks for valid/invalid email formats.

Replace backtracking regular expression with a linear single-pass validation for email autolinks (<user@domain.tld>), ensuring strictly O(n) parsing and preventing catastrophic backtracking.
@SMOSTAFAH1 SMOSTAFAH1 self-assigned this Nov 22, 2026
@SMOSTAFAH1 SMOSTAFAH1 linked an issue Nov 22, 2026 that may be closed by this pull request
@sonarqubecloud

Copy link
Copy Markdown

@SMOSTAFAH1
SMOSTAFAH1 merged commit 82037ae into develop Nov 22, 2026
4 checks passed
@SMOSTAFAH1
SMOSTAFAH1 deleted the perf/linear-autolink-email branch November 22, 2026 01:06
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.

perf(inline): the autolink email regex backtracks O(k²) on a@ + dots

1 participant