From: Jeffrey Czyz Date: Mon, 17 Jan 2022 04:54:42 +0000 (-0600) Subject: Add ProbabilisticScorer benchmarks X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=ed707908c30cf6dac1b5180683753282fe781f7e;p=rust-lightning Add ProbabilisticScorer benchmarks --- diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 9b308ee00..1b54e3a68 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -4990,7 +4990,7 @@ mod benches { use chain::transaction::OutPoint; use ln::channelmanager::{ChannelCounterparty, ChannelDetails}; use ln::features::{InitFeatures, InvoiceFeatures}; - use routing::scoring::{FixedPenaltyScorer, Scorer}; + use routing::scoring::{FixedPenaltyScorer, ProbabilisticScorer, ProbabilisticScoringParameters, Scorer}; use util::logger::{Logger, Record}; use test::Bencher; @@ -5067,6 +5067,22 @@ mod benches { generate_routes(bench, &network_graph, scorer, InvoiceFeatures::known()); } + #[bench] + fn generate_routes_with_probabilistic_scorer(bench: &mut Bencher) { + let network_graph = read_network_graph(); + let params = ProbabilisticScoringParameters::default(); + let scorer = ProbabilisticScorer::new(params, &payer_pubkey(), &network_graph); + generate_routes(bench, &network_graph, scorer, InvoiceFeatures::empty()); + } + + #[bench] + fn generate_mpp_routes_with_probabilistic_scorer(bench: &mut Bencher) { + let network_graph = read_network_graph(); + let params = ProbabilisticScoringParameters::default(); + let scorer = ProbabilisticScorer::new(params, &payer_pubkey(), &network_graph); + generate_routes(bench, &network_graph, scorer, InvoiceFeatures::known()); + } + fn generate_routes( bench: &mut Bencher, graph: &NetworkGraph, mut scorer: S, features: InvoiceFeatures ) {