[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT2 - Performance Expectancies
- From: "Matthew P. Del Buono" <delbu9c1@...>
- Date: Wed, 11 Nov 2009 14:37:39 -0500
Mike Pall wrote:
> Matthew P. Del Buono wrote:
>> lj_BC_TGETS = 13.81 (LuaJIT)
>
> That's a field or method access in the interpreter, i.e. obj.field
> or obj:method. Interesting that this makes it to the top.
>
>> lj_str_new = 7.17 (LuaJIT)
>
> Umm, you're creating or hashing a lot of strings there? If it's
> from Lua, then check for string.sub or the concat operator (..).
>
> If it's from C, then check for lua_pushstring, lua_getfield,
> lua_setfield. Too many of the latter two means you should consider
> redesigning your C code (don't access Lua objects by name, use
> references).
>
It's interesting you bring this up. After some other analysis, I had
determined we are in fact hitting a border case which hits both of these
problems simultaneously. We are constantly sticking an object in and out
of the registry. We index the registry for classifiers by string, so
this was resulting in strings being created a lot, and a lot of
getfield/setfield operations. I have already proposed the change to use
a static char's address as the key instead of a string, and the latter
problem of getfield/setfield should disappear when we are no longer
hitting that border case in the application (there's not much that can
be done about it).
>>>> Because it's not a standalone application, it seems I can't use
>>>> the "-jv" option.
>>> I bet you can. Just redirect it to a file:
>>>
>>> require("jit.v").start("dump.txt")
>> Very nice, thanks :)
>
> This should tell you why it doesn't compile much of your code.
> Probably because it has too many Lua <-> C transitions (a common
> trace abort reason would be: "NYI: C function ...").
>
> --Mike
Actually I wasn't getting that; I was getting a different warning instead:
[TRACE --- config.lua:9 -- NYI: return to lower frame at config.lua:10]
But this appears rarely so I think it is a non-issue.
I'm seeing performance improvement now, after a little work, of about
100 FPS, due to LuaJIT. This is without the registry change I mentioned
earlier.
Thanks again for the assistance as well as the great software :)
Regards,
======
Matthew P. Del Buono