Closed ghost closed 6 years ago
A while ago, New{List,Set,Map}()
would pre-compute the length and store it on the struct directly.
We currently sum up the numLeaves of all elements of a sequence. This was the case even before the current changes. This requires us to do a bunch of varint decoding but that is it. We already know the index of where this varint is located so we do not have to seek through the sequence at least.
It's very likely that API users will assume it is. E.g.
for i := 0; i < l.Len(); i++
.Right now it does some decoding for each call.