lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 19 February 2011 06:42, Robert G. Jakabosky <bobby@sharedrealm.com> wrote:
>
> The ZeroMQ [1] bindings [2] just got faster using LuaJIT2 FFI support.
> Another important feature of these new bindings is that they still work
> without FFI support, so the same .so module can be used with the standard Lua
> VM or with LuaJIT2.  This hybrid module has been created with the help of my
> LuaNativeObjects [3] bindings generator.  When the module loads and detects
> FFI support it will replace the normal C bindings with pure Lua code [4] that
> uses the FFI interface.

This looks really neat, and thanks for the benchmark.

One thing I noticed, unless I misread there's no gc hook for the
FFI-powered version to call zmq_close when the socket is garbage
collected. I think you need to create a userdata for each socket and
add a __gc hook there.

http://lua-users.org/lists/lua-l/2011-01/msg01214.html
http://lua-users.org/lists/lua-l/2011-01/msg01217.html

Regards,

Alex