Closed antonilol closed 3 months ago
Hey @antonilol 👋
Thank you for the great work but I am not ready to merge all of these unsafe
. I would rather you propose a trait change by following the #257 instructions and my comment (to declare a BytesEncode::zero_copy
method so that it's dynamic).
What do you think? We will then test that in Meilisearch to see the speed gain.
I am currently working on a new trait that is also (99%) backwards compatible with BytesEncode, this pr was more the 'quick fix' for what was possible with this current trait. The new one makes no heap allocations for primitive types, for both byte orders. Will make a (draft) pr with the current state of it!
Pull Request
Related issue
somewhat related to #257
What does this PR do?
Remove unnecessary allocations (heap allocations created with the
vec![...]
macro) in implementations of BytesEncode. Not all could be removed, without breaking the api, bytes need to be copied if they need to be flipped around (when using big endian integers on little endian machines).