Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: encoding: BinaryMarshaler should be an append API #24630
The BinaryMarshaler API returns a freshly allocated byte slice. This makes it unadvisable to implement for high performance APIs, or even APIs that could happen to be used in high performance scenarios.
If it had an append-like API (
The usability is not much worse, as
I ran into the same problem when implementing github.com/kevinburke/nacl and for the most part I chose the user-friendly API over the one with the best performance. In fact I believe you commented somewhere when I debuted that library pointing out that exact problem.
Is this something that could be better implemented within the compiler? Or with some pattern that's invisible to the user?
It would probably be easier to migrate if the
This is one case where default methods (#23185) are somewhat appealing, although of course the packages that check for