Closed moteus closed 9 years ago
this seems very promising!
very nice! i dont get how the "pos" variants will change things... would this introduce an (visible) API change?
There just 2 function decode
and decode_by_pos
. decode
stay with old signature.
The main benefit new function gets when you decode packet with multiple frames.
Encoding is same on Lua but on LuaJIT it little faster.
This benchmark is not fully true because it uses bit32
library on LuaJIT instead of its own. (I make PR to fix it tomorrow).
So for testing you can just replace frame.lua
and it should works.
changes are in PR #72 THX! :100:
I just public version of frame.lua that have no deps from struct library. Also it reduce number of
string.sub
operation during decoding so it faster when decoding multiple frames in single packet. This is drop in replacement but it also provide new functiondecode_by_pos
which returns position of next frame instead of rest string. It still needs more tests but this is my decode benchmark with luajit I do not make PR because this is not fully tested and this is easy run benchmarks based onwebsocket.frame
but when I done I make PR.