]> git.bitcoin.ninja Git - rust-lightning/commit
Reduce on-startup heap frag due to network graph map/vec doubling
authorMatt Corallo <git@bluematt.me>
Sat, 4 Nov 2023 03:53:46 +0000 (03:53 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 4 Nov 2023 04:00:04 +0000 (04:00 +0000)
commitc0107c6069200f997b7dcbaa997fd2e97d30b44f
treeb1fdb3abbd737917875ecbdf982c64cbf39883df
parent281a0aead744351c43fce660cf78f955fc969bfb
Reduce on-startup heap frag due to network graph map/vec doubling

When we're reading a `NetworkGraph`, we know how many
nodes/channels we are reading, there's no reason not to
pre-allocate the `IndexedMap`'s inner `HashMap` and `Vec`, which we
do here.

This seems to reduce on-startup heap fragmentation with glibc by
something like 100MiB.
lightning/src/routing/gossip.rs
lightning/src/util/indexed_map.rs