optimize encoding, do at most one extra pass if we exceed buffer size
more code reuse in mpack.Decoder