lua-users home
lua-l archive

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


Jerome Vuarand wrote:
2010/4/2 Stefan <stefan@chehalispost.com>:

Perhaps a benchmark is in order?

YAJL is reportedly among the fastest C JSON libs around. There is a Lua
module for it here:

http://github.com/brimworks/lua-yajl/

A trivial bench between lua-yajl and json4lua encoding a small array 100,000
times shows this:

alpha# time lua-5.1 yajltest.lua
3.967u 0.000s 0:03.97 99.7%     177+983k 0+0io 0pf+0w

alpha# time lua-5.1 jsontest.lua
9.170u 0.000s 0:09.17 100.0%    175+973k 0+0io 0pf+0w

230% faster is what I am seeing - YMMV

Thanks for the tip. lua-yajl decoding seems to be about 18% faster
than luajson, and encoding is 400% faster. But it seems to be a work
in progress, and it's less complete than luajson, so I guess I won't
switch just now.


Is that using the "recommended" Lua to_value(string) decoding convenience function? If so, then once it is implemented within the C module itself one would expect to see equally impressive improvement (as encoding)

But yes, I think he 1.0ed it a wee bit too soon...