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

  • From: Elias Hogstvedt <eliashogstvedt@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 18 Sep 2015 01:03:57 +0200

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?

Attachment: union.patch
Description: Binary data

Other related posts: