Serializes and deserializes Lua values with LuaJIT
Go to file
Robin Wellner ff25d2b2b6 Add a non-reentrant version of bitser
This may replace the default implementation if reentrancy does not seem
to be an important constraint for library users.

It tends to be much faster than regular bitser, helping it catch up with
lua-MessagePack and binser in the cases it lags behind.
2016-02-23 12:09:57 +01:00
cases Add a non-reentrant version of bitser 2016-02-23 12:09:57 +01:00
spec Prevent reading past the end of the buffer 2016-02-16 02:45:24 +01:00
.travis.yml don't do coverage for downloaded class libraries (hopefully) 2016-02-16 01:51:35 +01:00
bitser_nonreentrant.lua Add a non-reentrant version of bitser 2016-02-23 12:09:57 +01:00
bitser.lua Actually pass size along 2016-02-16 02:48:39 +01:00
conf.lua add first version, including benchmarks 2016-02-14 03:52:58 +01:00
main.lua Add a non-reentrant version of bitser 2016-02-23 12:09:57 +01:00
README.md Add mention of lua-MessagePack to README 2016-02-16 23:51:15 +01:00

bitser

Build Status Coverage Status

Serializes and deserializes Lua values with LuaJIT.

local bitser = require 'bitser'

bitser.register('someResource', someResource)
bitser.registerClass(SomeClass)

serializedString = bitser.dumps(someValue)
someValue = bitser.loads(serializedString)
serializedData = love.filesystem.newFileData("filename")
someValue = bitser.loadData(serializedData:getPointer(), serializedData:getSize())

Pull requests, bug reports and other feedback welcome! ❤️

Bitser is released under the ISC license (functionally equivalent to the BSD 2-Clause and MIT licenses).

Why would I use this?

Because it's fast. Because it produces tiny output. Because the name means "snappier" or "unfriendlier" in Dutch. Because it's safe to use with untrusted data.

Because it's inspired by binser, which is great.

How do I use the benchmark thingy?

Download zero or more of binser.lua, ser.lua, smallfolk.lua, serpent.lua and MessagePack.lua, and run:

love .

You do need LÖVE for that.

You can add more cases in the folder cases/ (check out _new.lua), and add other serializers to the benchmark in main.lua. If you do either of those things, please send me a pull request!

You can register classes?

Yes. At the moment, bitser supports MiddleClass, SECL, hump.class and Slither (and probably some other class libraries by accident).