Page 2 of 2

Re: bitser: faster, harder, better serialization with LuaJIT

Posted: Mon Feb 22, 2016 9:51 am
by Frohman
Looks interesting! I'll have to compare performance to msgpack. Does it build up some kind of schema internally? Could totally make use of that for some sexy delta encoding.

How does it handle tables of class instances (tables)?

Re: bitser: faster, harder, better serialization with LuaJIT

Posted: Wed Feb 24, 2016 11:36 am
by Robin
bitser now re-uses its internal buffer, decimating overhead for repeated serialization/deserialization
Frohman wrote:I'll have to compare performance to msgpack.
The repo includes a main.lua which is a benchmark framework to compare bitser to other serializers, including lua-MessagePack. I think you'll find that bitser tends to be roughly comparable to it, but if your data isn't a tree (so tables used in multiple places, or cycles) lua-MessagePack is not built for it so bitser has a huge advantage.
Frohman wrote:Does it build up some kind of schema internally?
Nope, it writes out everything as-is.
Frohman wrote:How does it handle tables of class instances (tables)?
When dumping, it looks for tell-tale signs of several class libraries, and writes out the name of the class as a string plus the instance variables as a table. When loading, it looks up the class name in the class registry and constructs an instance without calling the initializer.

Re: bitser: faster, harder, better serialization with LuaJIT

Posted: Thu Feb 02, 2017 12:06 pm
by trelemar
Sorry to bump this thread... But the author still updates it on GitHub so I figured it's worth a shot!

How would I go about serializing a table that contains ImageData? Is that what the "register" function is for? I'd like to have bitser automatically call ImageData:getString() when serializing a table with ImageData in it. Thanks in advance!

Re: bitser: faster, harder, better serialization with LuaJIT

Posted: Tue Feb 07, 2017 6:09 pm
by Robin
For static ImageData, you would use register(), yes.

If you're, say, writing a paint clone, or anything else where ImageData are created and manipulated at runtime, you would need to massage the data manually.

Re: bitser: faster, harder, better serialization with LuaJIT

Posted: Wed Feb 08, 2017 2:13 am
by trelemar
Thanks for the reply. I ended up converting the imagedata to a string then serializing the string. Then when you load the serialized data it converts it back to imagedata.

Re: bitser: faster, harder, better serialization with LuaJIT

Posted: Sun Jan 07, 2018 5:50 pm
by KayleMaster
If the buffer is too small at line 247 (It's currently at a fixed size of 4096), the game will crash silently (no error messages, no love.quit trigger).
Took me a while to figure out. I doubled the buffer size to Buffer_makeBuffer(8192) and now it works fine (for me).

Re: bitser: faster, harder, better serialization with LuaJIT

Posted: Sat Mar 03, 2018 5:48 pm
by Darlex
Daft punk??