Skip to content

Conversation

@nitely
Copy link
Owner

@nitely nitely commented Nov 24, 2024

Follow up #129

Reorder the epsilon transitions to be evaluated after the matchable node: @[matchable_node_idx, epsilon_transition_idx].

It helps avoiding pointless capts evaluation on regex with alternations: (foo|bar|...). Currently capts are evaluated for all alternations, even if only one matches. Note (foo|bar|...) translates to (foo)|(bar)|... internally to remove epsilon transition states, although all capts refer to the same capt node.

This improves #138 somewhat when using findAll (contains uses the no-capts optimization so no changes there).

This branch:

time nim c -r --threads:off -d:danger tests/test_bug/testbug.nim
compiled
2000
ok

real    0m7.232s
user    0m7.194s
sys     0m0.037s

Master:

time nim c -r --threads:off -d:danger tests/test_bug/testbug.nim
compiled
2000
ok

real    0m19.415s
user    0m20.467s
sys     0m0.270s

@nitely nitely merged commit c64d7e1 into master Nov 26, 2024
2 checks passed
@nitely nitely deleted the transitions_2 branch November 26, 2024 14:18
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.

2 participants