0

I am trying to compare bson serialization with json like that:

{
    "startAmount": 1000,
    "amounts": [
        1000,
        15000
    ],
    "stakes": [
        0.0395,
        0.0062
    ],
    "step": 10
}

Note that actual size for amounts and stakes is 1500. amounts are between 1000 and 15000, stakes just random value from 0.0001d to 0.05d. So when this json was passed to online bson serializer I got file 31.5 Kb, but original json size is 17.4Kb. In theory bson much smaller when it comes to pack numbers.

So what is wrong? Does this result correct or there is some mistake in packaging? Or may be bson require more space when numbers with dot are packaged?

Cherry
  • 31,309
  • 66
  • 224
  • 364
  • 1
    Why should BSON be smaller than JSON (unless the JSON contains a lot of spacing and indentation)? A `double` is 8 bytes. The string `0.0395` is only 6 bytes. BSON is optimized for parsing speed, not for size. – Thilo Jul 27 '16 at 02:57
  • 1
    Related: http://stackoverflow.com/questions/12601890/compare-json-and-bson – Thilo Jul 27 '16 at 02:58

0 Answers0