Thanks so much for your reply!
Yes, making Foo an io.WriterTo is exactly what I was looking for! I'll
have Foo implement both WriteTo and MarshalBinary methods (with the latter
making a new backing array with each call, and possibly using a sync.Pool
later on, after benchmarking actual use cas
I would start with the naive implementation first, and only make it fancier
(and more complicated) if that turns out not to be fast enough. Go's GC is
pretty good already and getting better.
You must not change the data in the returned slice after returning it,
unless you somehow know that the cal
Suppose there's a struct, say Foo, that needs to be serialized and sent
over the network very frequently (about every 100 microseconds to one
millisecond, to a multicast group). To serialize Foo to write it to an
io.Writer (e.g., a net.UDPConn), it would think it would be nice to have
Foo impl