Lokathor / tinyvec

Just, really the littlest Vec you could need. So smol.
https://docs.rs/tinyvec
Apache License 2.0
648 stars 49 forks source link

improve clone impl as per https://github.com/Lokathor/tinyvec/issues/143 #144

Closed Lokathor closed 3 years ago

Lokathor commented 3 years ago
Shnatsel commented 3 years ago

Wait, isn't clone_from supposed to discard the data that was previously contained by the collection? Why is there zip then? Nevermind I'm dumb

Shnatsel commented 3 years ago

I wonder if a fast path for Copy types is necessary, for cases like a long-ish vec of u64? I'm not sure the current implementation would lower to a memcpy()

Edit: something like Rgb struct would be more egregious that has several Copy types in it

Lokathor commented 3 years ago

Best as I understand, this is improving the situation in some but not all situations. If this code is bad for a particular copy type, then it was previously also bad for that type. EDIT: but i'm not generally familiar with when clone_from vs clone is called.