‹ BackHN Continuity

Thread

Packing Binary Is Fun

40 points · 17 comments · BurnerBurner

  1. kstenerud · · focus · HN ↗
    Schemas save you space, but then you lose the ability to understand the data without the schema. That's where JSON has always been handy despite its inefficiencies.

    Of course you can get the same kind of thing in binary. I wrote a drop-in binary JSON replacement because it's easy to write a binary one that's twice as fast as simjson and yyjson. The important thing is to never give the drop-in replacement any extras that break roundtrip compatibility.

    Was a fun little project to write, and quite useful for me: <a href="https:&#x2F;&#x2F;github.com&#x2F;kstenerud&#x2F;bonjson" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;kstenerud&#x2F;bonjson

    1. masklinn · · focus · HN ↗
      &gt; Schemas save you space, but then you lose the ability to understand the data without the schema. That&#x27;s where JSON has always been handy despite its inefficiencies.

      Of course that’s orthogonal to using a text v binary representation, you can have a schema’d text format, and a self-describing binary format.

      BSON, UBJSON, MessagePack and CBOR are binary but self-describing.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.