[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT 2.0 and external C libraries
- From: Mike Pall <mikelu-1003@...>
- Date: Thu, 25 Mar 2010 02:35:41 +0100
Alexander Nasonov wrote:
> For some reason I can't use -j so I can only guess
You can replace e.g. -jv with the following command at runtime:
require("jit.v").start("output.txt")
> Surely, string.find is not the
> greatest contributor but could it be that LuaJIT doesn't optimize
> a case of searching for a single char?
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.
> I search for the SOH and for the equal sign. I also do string.sub to
> get a tag and a value.
Much easier (and faster) to use a pattern with captures:
for tag, val in string.gmatch(msg, "([^=\001]*)=([^\001]*)\001") do
...
end
--Mike