chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] irregex and callbacks


From: Alex Shinn
Subject: Re: [Chicken-users] irregex and callbacks
Date: Thu, 2 Oct 2014 22:55:57 +0900

On Thu, Oct 2, 2014 at 10:05 PM, Peter Bex <address@hidden> wrote:
On Thu, Oct 02, 2014 at 01:47:15PM +0100, Andy Bennett wrote:
> Hi,
>
> > You could use submatch info and check which submatch matched.
> > This would keep the matching as a single regexp, but you'd then
> > need a linear scan to see which submatch succeeded.
>
> Thanks Alex!
>
> I'm trying to avoid the linear scan as there are several tens of
> thousand entries in the database. How expensive do you think it would be?

My guess is that it will fall back to a backtracking parser, as this would
certainly exceed the DFA compiler's size limit.  And that's going to be
extremely slow!

You could force DFA compilation, assuming the patterns
don't use any features that require backtracking, and assuming
there's no exponential explosion of states.  Compilation would
still be slow but execution would be fast.  You'd require some
internal help (checking tags in the final state) to quickly check
which pattern matched though.

What are the patterns like?  A specialized solution might be
better here.

-- 
Alex


reply via email to

[Prev in Thread] Current Thread [Next in Thread]