You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the most prominent use case for such an optimization the use of Addr in keys (map from user to whatever). Using Addr::as_bytes (returns &[u8]) when composing the final key save an intermediate allocation of 40-65 bytes for the address.
There can also be a 3rd option here, data in arrays:
enumKey<'a>{Borrowed(&'a [u8]),Short1([u8;1]),// can store 8 bit valueShort2([u8;2]),// can store 16 bit valueShort4([u8;4]),// can store 32 bit valueShort8([u8;8]),// can store 64 bit valueOwned(Vec<u8>)}
It might be worthwhile to return something like
Cow
fromKey::encode
. Some common cases (String
?) don't need us to compute a value.The text was updated successfully, but these errors were encountered: