Pre-allocate the full `Vec` prior to serializing as a `Vec<u8>`
authorMatt Corallo <git@bluematt.me>
Sat, 4 Nov 2023 21:01:18 +0000 (21:01 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 7 Nov 2023 04:12:30 +0000 (04:12 +0000)
commite4c6b70e8ee124ad91cbad84e36b5018da2d07a7
tree0e74f2fe88dc193143d4da99a9f283e23a462460
parente09afafc43b19770b0c52dcc04304b4e95a47f97
Pre-allocate the full `Vec` prior to serializing as a `Vec<u8>`

We end up generating a substantial amount of allocations just
doubling `Vec`s when serializing to them, and our
`serialized_length` method is generally rather effecient, so we
just rely on it and allocate correctly up front.
lightning/src/util/ser.rs