autonomys / subspace

Subspace Network reference implementation
https://subspace.network
380 stars 243 forks source link

Avoid allocation in `CowBytes` if possible #3120

Closed nazar-pc closed 3 weeks ago

nazar-pc commented 3 weeks ago

Instead of allocating unconditionally try to reuse original allocation if possible. BytesMut::from() tries to reuse allocation if possible.

Code contributor checklist:

teor2345 commented 3 weeks ago

This will need a branch update before it can auto-merge, I’ll do that now.