lua-users home
lua-l archive

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


Mike Pall wrote:
> It doesn't compile any of the pattern matching functions. Checking
> for a simple single-char match is possible, but that would be just
> a workaround for a specific case. The real solution is to add a
> pattern matching compiler. That's planned, but no ETA, yet.

Yes, pattern matching compiler would be great to have.

Even with it, there will be specific cases especially if you optimize
agressively. For instance, search for short strings when SSE4.2 is
available is a special case.

> Much easier (and faster) to use a pattern with captures:
> 
>   for tag, val in string.gmatch(msg, "([^=\001]*)=([^\001]*)\001") do
>     ...
>   end

I used a slighly different pattern (I also captured a position).
It was faster in plain Lua and a bit slower with LuaJIT.

Alex