-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nfa: improve construction times for small automatons
It turns out that #121 introduced a relatively sizeable performance regression when building very small automatons. Namely, several of the steps in the construction process took worst case `O(n^2)` time, where `n` corresponds to the alphabet size (255 in this case). This ends up not being too awful when the automaton is big (a lot of patterns), but it adds fairly sizeable overhead in the case of small automatons. We fix this by making these methods take linear time instead. This makes things a little more complicated, and perhaps there is a better abstraction to make this simpler. This was found by Ruff's benchmark suite: astral-sh/ruff#6964
- Loading branch information
1 parent
feda228
commit 4f5415e
Showing
1 changed file
with
101 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters