lua-users home
lua-l archive

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





On Mon, Nov 12, 2012 at 10:13 AM, François Perrad <francois.perrad@gadz.org> wrote:
2012/11/12 Matthieu Tourne <matthieu.tourne@gmail.com>:
>
>
>
> On Mon, Nov 12, 2012 at 3:43 AM, Pierre Chapuis <catwell@archlinux.us>
> wrote:
>>
>> >> luajit-msgpack-pure seems on par with lua-MessagePack, except for some
>> >> bad
>> >> edge cases (iary10000, dary1000)
>> >
>> > I did some experiments with FFI (see the branch 'ffi'
>> > http://github.com/fperrad/lua-MessagePack/tree/ffi),
>> > but on my hardware, I don't see improvement.
>>
>> Yes, François has shown me his code early and it turns out some
>> of my assumptions were wrong, including the fact that encoding
>> floating point numbers in pure Lua code is faster than using
>> a C cast with the FFI.
>>
>> As far as I am concerned this library almost makes
>> luajit-msgpack-pure redundant. Also, I think there are too
>> many MessagePack implementations out there. I would like
>> to see a "standardization" around Antirez's and François'
>> implementations. If they could have compatible APIs it would
>> be even better.
>>
>> If you need background on the mess MessagePack in Lua is,
>> read https://gist.github.com/2971290 ;) We have to move away
>> from this.
>
>
> Thanks for the clarification!
>
> I'd potentially be interested to use lua-msgpack-native, if it's faster than
> lua-cmgspack.
> But I don't use luvit, and I'm really not familiar with it.
> Is there a simple way to remove dependencies on luvit ?
>
> I tried to make a quick and dirty rockspec file, but it doesn't seem to
> work.

In fact, lua-msgpack-native doesn't depend on luvit.
You could replace in the Makefile the current target 'all' by these 4
following lines :
all: msgpack.so

msgpack.so: mp.c
        $(CC) $(CFLAGS) -I /usr/local/include -shared -o msgpack.so mp.c


Thank you! 
Here are the numbers to be exhaustive:  

** https://github.com/kengonakajima/lua-msgpack-native **

$ luajit bench_msgpack-native.lua 1000000                                                
    empty 0.170000 sec 5882352 times/sec
    iary1 0.200000 sec 5000000 times/sec
   iary10 0.750000 sec 1333333 times/sec
  iary100 0.610000 sec 163934 times/sec
 iary1000 0.600000 sec 16666 times/sec
iary10000 0.600000 sec 1666 times/sec
    dary1 0.000000 sec -9223372036854775808 times/sec
   dary10 0.010000 sec 999999 times/sec
  dary100 0.010000 sec 100000 times/sec
 dary1000 0.070000 sec 14285 times/sec
     str1 0.250000 sec 4000000 times/sec
    str10 0.250000 sec 4000000 times/sec
   str100 0.330000 sec 3030303 times/sec
  str1000 0.640000 sec 1562500 times/sec
 str10000 0.390000 sec 256410 times/sec
 str20000 0.730000 sec 136986 times/sec
 str30000 1.090000 sec 91743 times/sec
 str40000 0.140000 sec 71428 times/sec
 str80000 0.300000 sec 33333 times/sec


lua-msgpack-native is indeed the fastest implementation.

I'll see if I can figure out how to make a rockspec that works, as this could be useful to many outside of luvit.
Right now it keeps complaining for luaopen_<module_name> undefined symbols when require()-ing it.

Matthieu.