Closed dshulyak closed 5 years ago
Awesome finding! One suggestion is to implement encoding.BinaryMarshaler
by Contact
struct instead. That would make sure that Contact
is serialized always in the same way.
key is marshaled as a separate field now. i can check if it makes sense to define our type for *ecdsa.PublicKey
Ah right, gob
is not used anymore. So maybe something like contact.PublicKeyBytes()
. Of course the implementation can be as a function and PublicKeyBytes
can just use it. But if currently, we marshal public key only in one place, it does not matter.
Key with a curve takes in total 320 bytes. Without curve we can fit it into 34 bytes. But more importantly marshalling all curve parameters is slower than adding single byte identifier. So loading 10000 messages was improved From:
To: