Re: optimal settings (jit.opt) and tips for a large codebase? (take two)

  • From: Elias Hogstvedt <eliashogstvedt@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 21 Sep 2015 20:40:44 +0200

I've turned all my data to structs and removed the patch just to make sure
it's not that. I've also tweaked some options which helpes increasing
maxtrace and maxsnap seems to help a lot.

However the fps will still tank after stressing the jit compiler too much
by doing random things like opening the editor or restarting the renderer.
I've also noticed that if I do jit.flush() it will never recover. Maybe I'm
hitting some limit which flushes everything and it never recovers? I'm
using latest 2.1 from git.

On Fri, Sep 18, 2015 at 1:03 AM, Elias Hogstvedt <eliashogstvedt@xxxxxxxxx>
wrote:

I have a fairly large game engine project written in entirely in luajit
and I'm having some performance issues when rendering complex scenes. It's
gotten to a point where if I turn jit off while rendering a complex scene
performance can drop from 150 to 5 fps.

Things that help so far:
- Increasing maxmcode with jit.opt - this drastically improves
performance
- Apply the attached patch if using nested unions - this also
boosts performance but I suppose you could avoid using nested unions too.
(I use them to get swizzle-like functionality for data structures)
- Increase max unroll settings with jit.opts - this might increase
machine code size but it does seem to help with performance.

My issue now is performance dropping and then staying low after doing
other things in the engine (mainly using a gui).

For instance after loading a complex 3d scene the fps stay below 10 for a
bit while luajit is compiling and then eventually go up to 100 fps. This is
fine and expected but when I open another complex scene, like the editor
gui, performance will drop the same way and go up. But sometimes depending
on the complexity of the 3d scene and jit.opt settings the fps will stay
permanently low. I've experimented with increasing maxtrace, maxrecord, etc
but it just seems to worsen the problem.

Having some of the max* settings too high seems to crash luajit too
randomly while compiling.



The attached patch for unions was originally posted here:
http://permalink.gmane.org/gmane.comp.lang.lua.luajit/5489
Mike seems somewhat reluctant to apply the patch. Maybe it needs to be
tested or improved/done properly?

Other related posts: