[Haskell-cafe] Efficient parallel regular expressions

Martin DeMello martindemello at gmail.com
Tue Nov 4 16:26:10 EST 2008


On Tue, Nov 4, 2008 at 9:05 AM, Martijn van Steenbergen
<martijn at van.steenbergen.nl> wrote:
>
> For my mud client Yogurt (see hackage) I'm currently working on
> improving the efficiency of the hooks. Right now several hooks, each
> consisting of a regex and an action can be active at the same time.
> Every time a line of input is available (usually several times a second)
> I run the line through all the available regexes and execute the first
> matching action.
>
> I figured this is not the cleverest approach and it'd be better if I
> |'ed all regexes into one big DFA. However, how do I then find out which
> of the original hooks matched and so which action to execute?

Is this really a problem in practice? I've done similar things in
Ruby, which is a much slower language, and not had any issues -
particularly in something IO bound like a MUD client it doesn't seem
that running down a few tens of regexps would be a bottleneck of any
sort.

martin


More information about the Haskell-Cafe mailing list