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)?
bitser: faster, harder, better serialization with LuaJIT
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: bitser: faster, harder, better serialization with LuaJIT
bitser now re-uses its internal buffer, decimating overhead for repeated serialization/deserialization
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:I'll have to compare performance to msgpack.
Nope, it writes out everything as-is.Frohman wrote:Does it build up some kind of schema internally?
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.Frohman wrote:How does it handle tables of class instances (tables)?
Help us help you: attach a .love.
Re: bitser: faster, harder, better serialization with LuaJIT
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!
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!
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: bitser: faster, harder, better serialization with LuaJIT
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.
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.
Help us help you: attach a .love.
Re: bitser: faster, harder, better serialization with LuaJIT
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.
-
- Party member
- Posts: 234
- Joined: Mon Aug 29, 2016 8:51 am
Re: bitser: faster, harder, better serialization with LuaJIT
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).
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
Daft punk??
Hi! I wish you have an amazing day!
Who is online
Users browsing this forum: No registered users and 12 guests