What is the fastest way to serialize and compress a javascript hashmap (object) in NodeJS 12+? I'm trying to find the fastest combination of serialization and compression methods to transform a javascript object into binary data.
The number of possible combinations is 100+, my goal is a pre-study to choose several best options for final benchmark.
Input: an object having arbitrary keys, so some really fast serialization methods like AVSC cannot be used. Assume that the object has 30 key-value pairs, example:
{
"key-one": 2,
"key:two-random-text": "English short text, not binary data.",
... 28 more keys
}
No need to support serialization of Date, Regex etc.
Serialization only schemaless serialization formats can be taken into account, like JSON or BSON. V8.serialize is an interesting option, probably it's fast because it's native. Compress-brotli package added it's support for some reason, but did not provide a benchmark or highlighted it as a recommended option.
Compression Probably only fastest methods should be considered. Not sure if brotli is a perfect choice because according to wiki it's strong in compressing JS, CSS and HTML because expects "keywords" in input. Native nodejs support is preferred.
I've found a helpful research for a similar use case (I'm planning to compress via lambda and store in S3), but their data originates in JSON, opposite to my case.
from Fastest way to serialize and compress a hashmap (object) in nodejs?
No comments:
Post a Comment