Here has been a lot of talk on the Lua mailing list about a new feature in 
LuaJIT2 called FFI (foreign function interface).  The new FFI feature greatly 
improves the performance of Lua code when running under LuaJIT2, but it 
doesn't work under the standard Lua VM.  So I have create a hybrid Lua module 
[1] that has normal C bindings and FFI-based bindings for 0MQ.

Also the new bindings have support for sending/receving messages using the 
zmq_msg_t structure.  This improves the performance even more under LuaJIT2 
and gets the throughput to almost equal that of the C++ benchmark.

Throughput benchmark using the tcp transport over localhost:
message size: 30 [B]
message count: 100000000

Orignal Lua bindings running under Lua 5.1.4:
mean throughput: 1395864 [msg/s]
mean throughput: 335.007 [Mb/s]

New bindings running under Lua 5.1.4:
mean throughput: 1577407 [msg/s]
mean throughput: 378.578 [Mb/s]

Orignal Lua bindings running under LuaJIT2 (git HEAD):
mean throughput: 2516850 [msg/s]
mean throughput: 604.044 [Mb/s]

New bindings running under LuaJIT2 (git HEAD):
mean throughput: 5112158 [msg/s]
mean throughput: 1226.918 [Mb/s]

New bindings using send_msg/recv_msg functions running under LuaJIT2 (git 
HEAD):
mean throughput: 6160911 [msg/s]
mean throughput: 1478.619 [Mb/s]

C++ code:
mean throughput: 6241452 [msg/s]
mean throughput: 1497.948 [Mb/s]


1. https://github.com/Neopallium/lua-zmq

-- 
Robert G. Jakabosky
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to