[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug in pattern matching
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 14 May 2012 20:46:41 -0300
> I believe I've found a bug in the pattern matching implementation.
> Executing the code below shows that each iteration takes under 1
> second.
>
> local pattern = "b"
> for len=10000,100000,10000 do
> local t = os.time()
> ("a"):rep(len):find(pattern)
> print(len, os.time() - t)
> end
>
> On the other hand, if the pattern string is ".*b", this is how long
> it's taking:
>
> [...]
This is literally a textbook example: http://www.lua.org/pil/20.4.html
> [...] I think some "cleverness" is missing in the implementation.
Missing cleverness is not a bug.
-- Roberto