You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a vector every time GroupElement::to_bytes() is called is slow because it's allocated on the heap. It would be much faster to return a constant sized array. If the two implementations of GroupElement need to return different sized arrays, an alternative solution is to have to_bytes write to a slice that is passed in.
The text was updated successfully, but these errors were encountered:
You are correct. I don't want to break existing usages of to_bytes by dependent codebases but I can certainly add a new method to_bytearray that takes a mutable slice as you mentioned. And overtime, to_bytes can be removed.
In Rust conventions, naming a function to_ means you are returning something, so I would maybe name the new function write_to_bytes to make it more clear.
Afterwards the new function should be used internally wherever the old one was used.
Creating a vector every time GroupElement::to_bytes() is called is slow because it's allocated on the heap. It would be much faster to return a constant sized array. If the two implementations of GroupElement need to return different sized arrays, an alternative solution is to have to_bytes write to a slice that is passed in.
The text was updated successfully, but these errors were encountered: