Closed aep closed 4 years ago
Hi Arvid,
let's first distinguish indefinite length strings (which are a construct build on top of definite length strings) from indefinite length containers (arrays, maps). I think you are talking about the latter.
There are two reasons why definite length containers may be the better choice:
If these are not important to you, be our collective guest and go indefinite as much as you want -- that's why that is in there. (Unless you need deterministic encoding, which is biased towards definite, but of course you can define your own deterministic encoding rules.)
thanks,
maybe found the answer in https://github.com/msgpack/msgpack/issues/128#issuecomment-21143606 That is some languages require realloc on array append, which might copy, so that's alot slower than a known size alloc.
curious why protobuf opted for not sizing arrays at all tho
there's some subtle hints about indefinite length items not being desirable in some circumstances, but it's very unclear why. Actually i'm unsure why i would ever use definite lengths at all.
someone also complained on reddit (cant find the link anymore) that indefinite length items are a design mistake in cbor, but i can't figure out why. They seem fine.