Re: LuaJIT Matrix Algebra Function

  • From: Eliot Eikenberry <eliot.darkwolf@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 7 Sep 2014 22:14:34 -0400

There are pointer swaps going on to avoid doing array copies.

On Sun, Sep 7, 2014 at 10:02 PM, Josh Simmons <simmons.44@xxxxxxxxx> wrote:

> On Mon, Sep 8, 2014 at 11:34 AM, Eliot Eikenberry
> <eliot.darkwolf@xxxxxxxxx> wrote:
> > I just got my oculus rift dk2 and have been working on setting
> everything up
> > to run in lua and moving a bunch of my old games into lua to use with it
> and
> > had a reason to do the same with with matrix (and vector,
> > quaternion,etc...).
> >
> > On my machine, the code in Evan's gist runs in 0.058 on average.
> > Your hybrid code above runs at about 0.088.
> > The code at this gist runs at about 0.038 :
> > https://gist.github.com/Wolftousen/99a0c6835a1130b96965
> >
> > Unfortunately, since i'm using opengl and double type matrices aren't
> > supported unless you are running version 4, i have to use floats instead
> of
> > doubles which slows it back down to about 0.059.  But regardless,
> awesome we
> > can get stuff so close to c speeds.
> >
>
> I didn't look too deeply so I might have missed something but I'm not
> sure why you don't change your matrix to
>
> struct mat4 { double data[16]; };
>
> to avoid the extra allocations and indirection.
>
>

Other related posts: