Skip to content

Conversation

@ofabiodev
Copy link
Owner

Current power iteration always runs the maximum number of iterations, causing unnecessary computation for most regex patterns. This PR will:

  • Add early stopping when eigenvector converges
  • Preserve spectral radius accuracy
  • Improve performance for large NFAs

📊 Performance Gains

Matrix Size Original Avg (ms) New Avg (ms) Improvement
50x50 1.499 0.422 ~70%
200x200 10.689 0.999 ~90%
500x500 59.448 3.807 ~93%

@ofabiodev ofabiodev force-pushed the power-iteration-early-stop branch from ef14139 to 40850bb Compare December 26, 2025 16:35
@ofabiodev ofabiodev merged commit 99f84a8 into main Dec 26, 2025
1 check passed
@ofabiodev ofabiodev deleted the power-iteration-early-stop branch December 26, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants