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.
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.