As a Roblox developer, it is currently too hard to save data in an efficient way with binary based file specification. This happens since DataStores can only save plain-text JSON files (which also means binary values will get casted to \uXXXX
)
The issue with JSON is that it has a lot of unneccessary whitespace, the JSON syntax characters; {, }, [, ], ", : and ,
can create a lot of whitespace that wont be present with a binary spec. (Binary has whitespace characters as well, sizeof identifiers etc. but the size impact of these are not as much as JSON’s whitespace characters
Another issue with JSON is that schemas and structs cannot be stored and will need to be declared repetitively for multiple datums of the same struct, where with a binary spec, we can create the shcema once then create a simple list of pairs for everything in that struct.
There are definitely tricks to reduce the amount of space taken up by repetitive JSON data, however they’re monotonous and that point you’d still be better off just using binary.
The only way to store binary data right now is to encode it as base64, which results, on average, a 34% size increase on the original data.
Lets take Luau bytecode, a binary format. (Standard debug setting, simple hello world script)
- With the bytecode spec, this takes up 78 bytes
- With a best interpretation as JSON, it will take up 322 bytes
If Roblox is able to address this issue, it would improve my development experience because I could then utilise binary based specification to reduce more space against the 4MiB byte cap.