Get the latest tech news
Fast Lua Serialization (2023)
You’re writing lua, you want to serialize and deserialize data, and you want to pick the best format/library pairing for the job. What’s good? I’ve been doing some testing to find out. Here’s the short version: If you want the fastest option and you can choose the format, use lua-cbor if you need it to be pure lua, or use lua-protobuf if you’re cool with a C library. If you need JSON, use either lunajson for pure lua, or lua-cjson for a faster C implementation. And now, the details.
Here’s the short version: If you want the fastest option and you can choose the format, use lua-cbor if you need it to be pure lua, or use lua-protobuf if you’re cool with a C library. That said, if all you need is binary strings, lua-MessagePack is probably going to be about as applicable to the task as the CBOR library I’ll talk about next, but I just find it a bit more of a hassle to use. The lua-cbor library is well written, incredibly fast, has good defaults, but is flexible enough to handle mixed string formats in a reasonable fashion.
Or read this on Hacker News