From d5db85ecc5f71ff4c37b3d295fbc8e0f773d0b24 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Sun, 16 Jan 2022 22:54:42 -0600 Subject: [PATCH] Add ProbabilisticScorer benchmarks --- lightning/src/routing/router.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index f31bfd2ea..a21cf79a1 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -4984,7 +4984,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; @@ -5061,6 +5061,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, &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, &network_graph); + generate_routes(bench, &network_graph, scorer, InvoiceFeatures::known()); + } + fn generate_routes( bench: &mut Bencher, graph: &NetworkGraph, mut scorer: S, features: InvoiceFeatures ) { -- 2.39.5