uuid icon indicating copy to clipboard operation
uuid copied to clipboard

feat: avoid copying in TryFrom<Vec<u8>>

Open pjenvey opened this issue 1 year ago • 1 comments

Closes #733

pjenvey avatar Feb 04 '24 00:02 pjenvey

Hi @pjenvey :wave:

For what it's worth it looks like these generate roughly equivalent code, but the existing implementation is slightly better: https://godbolt.org/z/138rGesMz

We end up creating a copy of the bytes anyway since uuid takes ownership of them. Did you observe some surprising behavior attempting to use these TryFrom conversions?

KodrAus avatar Feb 04 '24 23:02 KodrAus

Thanks for the PR @pjenvey. I couldn't find a compelling reason to change this; they seemed to generate the same code, so will close this one to keep the source a bit simpler.

If you do notice any real-world impact here please feel free to re-open.

KodrAus avatar Mar 20 '24 03:03 KodrAus