Drop writer size hinting/message vec preallocation
authorMatt Corallo <git@bluematt.me>
Sun, 29 Aug 2021 05:26:39 +0000 (05:26 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 18 Sep 2021 01:01:41 +0000 (01:01 +0000)
commit07b674ecb1b92028ba830e8de056d669e50f3752
treeb43703b7dc49e2cd5835f93b066c3584c93e3402
parent4c4d99b291c5336130d3d5cfeffa8ab88fd97783
Drop writer size hinting/message vec preallocation

In order to avoid significant malloc traffic, messages previously
explicitly stated their serialized length allowing for Vec
preallocation during the message serialization pipeline. This added
some amount of complexity in the serialization code, but did avoid
some realloc() calls.

Instead, here, we drop all the complexity in favor of a fixed 2KiB
buffer for all message serialization. This should not only be
simpler with a similar reduction in realloc() traffic, but also
may reduce heap fragmentation by allocating identically-sized
buffers more often.
fuzz/src/chanmon_consistency.rs
fuzz/src/chanmon_deser.rs
fuzz/src/msg_targets/utils.rs
lightning/src/chain/transaction.rs
lightning/src/ln/features.rs
lightning/src/ln/msgs.rs
lightning/src/ln/peer_handler.rs
lightning/src/util/ser.rs
lightning/src/util/ser_macros.rs
lightning/src/util/test_utils.rs