Pipe filesystem writes in `lightning-persister` through `BufWriter` 2022-04-buf-writes
authorMatt Corallo <git@bluematt.me>
Sun, 3 Apr 2022 01:04:26 +0000 (01:04 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 3 Apr 2022 21:54:15 +0000 (21:54 +0000)
commit7e93fdb29aeb755f937b4c8b2a10bad957298cf0
treec6e2cfd135372adb290223a331bb489e178f8b18
parentaf318312c5a12f3cb3b6e1af788b3bd620d4dbe5
Pipe filesystem writes in `lightning-persister` through `BufWriter`

We generally make no effort to ensure all writes are buffered in
lower-level objects, so wrapping write calls in `BufWriter` may
substantially improve performance in some cases. This is especially
important now that we block the sample node exit until the
`NetworkGraph` has been written out, which includes many small-ish
writes.

With this change, shutdown of the sample node on a relatively
underpowered device went from 15-30 seconds of CPU time to a second
or two, plus IO sync time.
lightning-persister/src/lib.rs
lightning-persister/src/util.rs