[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Bug in pattern matching
- From: Gabriel Z M Ramos <gabriel@...>
- Date: Mon, 14 May 2012 20:07:40 -0200
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:
10000 0
20000 4
30000 7
40000 13
50000 19
60000 28
70000 39
80000 55
90000 67
100000 84
Not even ".*b$" helps. I think some "cleverness" is missing in the
implementation.
Cheers
-- gabriel