Skip to content

Commit

Permalink
Make AhoCorasick.Automaton.Next strict
Browse files Browse the repository at this point in the history
I have no evidence that this affects performance, but it makes the
intent a bit clearer perhaps. Benchmark times:

Before:
  mean time: 3.008 ± 0.012 seconds
   min time: 2.964 seconds

After:
  mean time: 3.029 ± 0.017 seconds
   min time: 2.966 seconds
  • Loading branch information
ruuda committed Mar 11, 2019
1 parent f3e6d3d commit 0db7fc9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Data/Text/AhoCorasick/Automaton.hs
Expand Up @@ -413,8 +413,8 @@ uAt = UVector.unsafeIndex
-- | Result of handling a match: stepping the automaton can exit early by
-- returning a `Done`, or it can continue with a new accumulator with `Step`.
data Next a
= Done a
| Step a
= Done !a
| Step !a

-- | Run the automaton, possibly lowercasing the input text on the fly if case
-- insensitivity is desired. See also `lowerCodeUnit` and `runLower`.
Expand Down

0 comments on commit 0db7fc9

Please sign in to comment.