Please sign in to comment.
Fix exponential explosion in backtrack compilation
The trick is to define * in terms of +, instead of vice versa, because if you do it the other way around you must compile the remaining regex twice, and if that remainder uses +, it will compile its remainder twice, and so forth, resulting in 2^n compilations.
- Loading branch information...
Showing with 20 additions and 14 deletions.