Currently during serialization we use:
c.RepeatedMessage(1, func(c *picobuf.Decoder) {
m.Values = append(m.Values, Value{})
c.Loop(m.Values[len(m.Values)-1].Decode)
})
However, this can cause significant reallocations. It might be useful to lookahead and try to either estimate or count the exact number of values that need to be unserialized and preallocate m.Values to be sufficient.
Currently during serialization we use:
However, this can cause significant reallocations. It might be useful to lookahead and try to either estimate or count the exact number of values that need to be unserialized and preallocate
m.Valuesto be sufficient.