The Nostr canonical event format should have been an array.
Discussion
🙌
Using arrays encoded in CBOR instead of JSON maximizes parsing speed, and like JSON, CBOR is schemaless. For binary efficiency that’s close to JSON, CBOR is the best — IPFS uses CBOR for a reason.
CBOR is completely useless. Schemaless is a bad idea, CBOR just improves 0.1% over JSON and because of that you lose all the JSON tooling in the world.
I guess if the Nostr event format was an array like I thought 5 hours ago then we would have basically lost that too. I think the way things are is better indeed.
CBOR is only a bit faster indeed, but the real gains come from switching to binary with the array.
I suggested CBOR because it is the simplest binary encoder, akin to JSON. All the other binary encoders require schemes. JSON is schemaless, like CBOR.
We spent a lot time making everything backwards compatible btw, so I hope JSONs are quick enough for the future. :-)
fastest is Gob but all those rustaceans would cry.
NSON is pretty fast: https://github.com/nbd-wtf/go-nostr/tree/master/nson
But when you compare the speed gains of using anything other than JSON (even if you use the fastest possible binary encoding) with the time it takes to verify a signature then you see how pointless all these efforts are.