Re: sometimes match or gmatch are very slow under luajit (compared to raw lua)

  • From: Jason <jpriest8ml@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 18 Sep 2012 22:48:06 -0500

On 09/18/2012 07:00 AM, Ronan Collobert wrote:
> I am using the last luaJIT from the luajit-2.0 git master branch, as well as 
> lua 5.1.4.

I tried as well with LuaJIT from fresh git-head and Lua 5.1.4.
Similar results.

> Any idea?

$ luajit -jv test.lua
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]
[TRACE --- test.lua:7 -- NYI: FastFunc string.gmatch_aux]

So it aborts the trace. Eleven times in a row...
So let's try turning off the JIT?

$time luajit -jon test.lua
real    0m1.352s
user    0m1.340s
sys     0m0.008s

$time luajit -joff test.lua
real    0m1.342s
user    0m1.336s
sys     0m0.004s

No difference...

I tried my hand at `git bisect` today.
It's a very useful tool.

420124372b7643410a1cdd6f80b9cc8aa6ec1302 is the first commit with this
slow down. All of the ones preceding it are roughly the same speed as
Lua 5.1 while after this point, LuaJIT is 7.5x slower for this example.

For those interested in the commit diff:
http://repo.or.cz/w/luajit-2.0.git/commitdiff/420124372b7643410a1cdd6f80b9cc8aa6ec1302?hp=d05873ee0ae63ee47710a2c9843d032010cc296f

Hope this helps in some way if you haven't performed this already, Mike.

Other related posts: