[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Time constraint in Lua pattern functions
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 14 Mar 2016 16:02:17 -0300
> After I've upgraded Lua to 5.3.2, one of my scripts terminates with
> "pattern too complex" error message.
>
> Probably, this is because of gmatch using non-optimal pattern
> (having quadratic time complexity), which may require up to 2 sec
> to complete.
>
> Of course, it is possible to rewrite that script to make its time
> complexity linear (at the cost of extra LOC and more complex logic
> of code).
>
> But the are two reasons for NOT rewriting it:
> 1) I don't want to spent my time on rewriting my old script
> because I'm quite happy with its current performance (2-3 seconds
> is OK for me).
> 2) I don't want to bring extra complexity to the script.
> As for now, it is one-liner regexp, and I'd like to stay it
> as simple as it is.
Can you show your regexp/subject?
-- Roberto