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=18e467b92a199b9c1a2048aaadbd33426061f325;p=rust-lightning Add ProbabilisticScorer benchmarks --- diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 10bef9665..c7d57fabc 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 ) {