Results:
---
Benching json
Encoding 6 values 10000 times: 58ms
Sizes: 14b, 14b, 18b, 42b, 91b, 196b
Decoding 6 values 10000 times: 73ms
---
Benching bson
Encoding 6 values 10000 times: 212ms
Sizes: 13b, 16b, 23b, 40b, 85b, 182b
Decoding 6 values 10000 times: 207ms
---
Benching bsonExt
Encoding 6 values 10000 times: 425ms
Sizes: 13b, 16b, 23b, 40b, 85b, 182b
Decoding 6 values 10000 times: 202ms
---
Benching cbor
Encoding 6 values 10000 times: 1461ms
Sizes: 8b, 10b, 14b, 28b, 60b, 131b
Decoding 6 values 10000 times: 1803ms
---
Benching json + gzip
Encoding 6 values 10000 times: 8411ms
Sizes: 34b, 34b, 38b, 62b, 73b, 85b
Decoding 6 values 10000 times: 739ms
---
Benching bson + gzip
Encoding 6 values 10000 times: 8701ms
Sizes: 33b, 35b, 41b, 57b, 67b, 80b
Decoding 6 values 10000 times: 749ms
---
Benching bsonExt + gzip
Encoding 6 values 10000 times: 9490ms
Sizes: 33b, 35b, 41b, 57b, 67b, 80b
Decoding 6 values 10000 times: 1442ms
---
Benching cbor + gzip
Encoding 6 values 10000 times: 12901ms
Sizes: 28b, 30b, 34b, 48b, 55b, 66b
Decoding 6 values 10000 times: 2769ms
Thoughts:
- gzipSync is pretty slow, is that a bug in my code?
- bsonExt is a native module; you'd expect perf improvements over bson but the JS/native barrier must be slowing it down. It might see better perf than BSON on larger objects? Not sure
- cbor's native module, tinycbor, failed to compile so it didnt get tested
- compression only gets useful after ~80b, which is expected