Nostr performance pro tip: put the `id` field first in an event.

This enables clients and relays to abort deserialisation if they've already seen the event.

After that the `created_at` and `kind`, as that can also eliminate unnecessary deserialisation early on.

Reply to this note

Please Login to reply.

Discussion

Wouldn't the deserialization happen before the code could read the value? Or do some languages steam data into a deserialization method somehow?

Follow-up: in the order of the id hash would be nice. This way the SHA256 can run along with the stream decoder, no need to store intermediate stuff.

So id, pubkey, created_at, kind, tags, content and sig at the end.

Please.