[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How close to C do you make your binding?
- From: Tom N Harris <telliamed@...>
- Date: Fri, 20 Jun 2014 14:53:48 -0400
On Thursday, June 19, 2014 03:49:49 PM Andrew Starks wrote:
> Rule #1: Get thee from C to Lua as fast as possible.
>
> This means that your binding will look very much like C. Where it doesn't,
> it will most likely be due to memory management, and data types. The other
> differences are "true" and "false" and multiple returns. Here, Lua can make
> it less tedious and the amount of variance is probably a judgement call.
>
> From there, you can, and according to your taste should, "do it all again"
> by wrapping the core binding around an object model.
This is a useful rule when you want to take advantage of LuaJIT. The compiler
can optimize Lua code very well. If your module has much of its logic hidden
in the C module, those code paths will be hidden to the JIT compiler. So a
thinner translation layer is preferred.
--
tom <telliamed@whoopdedo.org>