rust-lightning/bench
Matt Corallo 259ceb0ebf Add an option to make the success probability estimation nonlinear
Our "what is the success probability of paying over a channel with
the given liquidity bounds" calculation currently assumes the
probability of where the liquidity lies in a channel is constant
across the entire capacity of a channel. This is obviously a
somewhat dubious assumption given most nodes don't materially
rebalance and flows within the network often push liquidity
"towards the edges".

Here we add an option to consider this when scoring channels during
routefinding. Specifically, if a new `linear_success_probability`
flag is unset on `ProbabilisticScoringFeeParameters`, rather than
assuming a PDF of `1` (across the channel's capacity scaled from 0
to 1), we use `(x - 0.5)^2`.

This assumes liquidity is likely to be near the edges, which
matches experimental results. Further, calculating the CDF (i.e.
integral) between arbitrary points on the PDF is trivial, which we
do as our main scoring function.

While this (finally) introduces floats in our scoring, its not
practical to exponentiate using fixed-precision, and benchmarks
show this is a performance regression, but not a huge one, more
than made up for by the increase in payment success rates.
2023-09-20 18:32:21 +00:00
..
benches Add an option to make the success probability estimation nonlinear 2023-09-20 18:32:21 +00:00
Cargo.toml Replace std's unmaintained bench with criterion 2023-05-11 06:11:49 +00:00
README.md Add trivial README to bench to describe how to run them. 2023-05-11 06:11:51 +00:00

This crate uses criterion to benchmark various LDK functions.

It can be run as RUSTFLAGS=--cfg=ldk_bench cargo bench.

For routing or other HashMap-bottlenecked functions, the hashbrown feature should also be benchmarked.