i'm not sure if it is worth doing but I had an idea in my head for the simplest version of a binary encoding I could think of and wanted to put it out there.

the encoding-lowercase-hex-tags-as-bytes makes a big difference in contact lists (74kb -> 36kb). its the difference between 1mb and 500kb upload when subscribing to 10 relays with your follow list, assuming something like this was ever adopted.

Reply to this note

Please Login to reply.

Discussion

Well, for the wire, I don't really care that much because almost every relay compresses the data anyway. So, the gain is minimum for all the conversion required.

But for the local db, I thought the biggest gains came from creating a "table" just for all the possible strings in tags + pubkeys + ids + addresses. Then, instead of having 32 or 64 bytes for each tag, we have 4 bytes for an Int, which would be more than enough to represent everything in a single-user db.

However, converting them back and forth for queries and so on becomes quite expensive.

But the savings are really 10-20x.

So, I tried some hashcode methods to avoid having to save a table and convert. That works, but collisions are way higher.