[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Simplex noise (2D and 3D) with the LuaJIT FFI
- From: Michael Gogins <michael.gogins@...>
- Date: Wed, 23 Feb 2011 07:33:10 -0500
It would be very useful to me, and I am sure to many others, who are
beginning to use LuaJIT for serious stuff that only used to be
possible in C/C++/Fortran... if there were a summary of "good
practices in high-performance programming in LuaJIT + FFI".
A wish...
Thanks,
Mike Gogins
On Wed, Feb 23, 2011 at 5:43 AM, Mike Pall <mikelu-1102@mike.de> wrote:
> Steven Johnson wrote:
>> Also, since I brought up "register coalescing too complex", what will
>> that account for when it's no longer NYI? Or considered otherwise, are
>> there specific constructs to avoid now, if it can be helped?
>
> This happens if too many locals are live across a branch to a side
> trace. The bytecode data-flow analysis I've added yesterday should
> help with this, provided the locals are actually unused in that
> branch.
>
> If that analysis fails, you can limit the impact with 'do ... end'
> wrappers around lengthy calculations, which involve lots of
> temporaries that go dead after that. Moving this to an extra
> function may be a good idea, too.
>
> Also: always declare temporaries in the innermost scope of their
> use, preferably initializing them at the same time. This happens
> to be good Lua coding style, too. Don't give in to the habit of
> declaring all local variables at the top of the function (which
> originates in a limitation of the ancient K&R C).
>
> --Mike
>
>
--
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com