Avoid excess multiplies by multiplying in `success_probability` 2023-12-cache-scoring-points
authorMatt Corallo <git@bluematt.me>
Mon, 11 Dec 2023 03:33:46 +0000 (03:33 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 12 Dec 2023 04:28:35 +0000 (04:28 +0000)
commitfe3560e86ada1ced358e99986c1edb8926a5d2a4
tree0af2309e08b864c0f2441076b695dccd5eeeff34
parentae040c6effb29bc2d34aa5dca61117da320b86ee
Avoid excess multiplies by multiplying in `success_probability`

A substantial portion (~12%!) of our scoring time is spent dividing
the bucket pair probability by the `success_probability` divisor.

Here, we avoid this by multiplying the bucket pair probability
in floating point math and using a floating point divide (which can
be faster in some cases). This also avoids the 2^30 multiplies that
are used to avoid rounding errors when converting the float
numerator and denominator to ints.
lightning/src/routing/scoring.rs