nervosnetwork / molecule

Another serialization system: minimalist and canonicalization.
MIT License
36 stars 23 forks source link

perf: use const functions as default constructors (only for `std`) #54

Closed yangby-cryptape closed 2 years ago

yangby-cryptape commented 2 years ago

Bytes::from_static(..) is a const function, we can use it in the default constructor for entities to improve the performance.

Ref: pub const fn from_static(bytes: &'static [u8]) -> Bytes.