]> git.bitcoin.ninja Git - rust-lightning/commit
Avoid excess multiplies by multiplying in `success_probability`
authorMatt Corallo <git@bluematt.me>
Sat, 16 Dec 2023 01:52:44 +0000 (01:52 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 17 Jul 2024 14:39:29 +0000 (14:39 +0000)
commit04cbdb8e4eeeb5665a61120e2ea91e7006fbc6c5
treee99116ae99b15a339f16ec4ba4b9b579ade0b743
parent24083c10e7fafab279a6a74cc8aee30a695ef623
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