lua-users home
lua-l archive

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


On 09/11/2014 11:26 AM, Paul K wrote:
Hi Peng,

I suppose for patterns other than of single character, the order really
should affect the perfomance. could you test it again using complex patterns?
Thank you for the explanation. I tested on 10-char patterns, but
'1'-first performs better than 'a'-first on some tests (20-50
iterations for 100M char string).

lpeg.match((lpeg.S('1111111111')+lpeg.S('aaaaaaaaaa'))^0, str)

Anything else I should try?

Paul.

you shoud try lpeg.P('aaaaaaa'). the S of lpeg.S stands for ``set``.