Add ProbabilisticScorer benchmarks
authorJeffrey Czyz <jkczyz@gmail.com>
Mon, 17 Jan 2022 04:54:42 +0000 (22:54 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Thu, 20 Jan 2022 22:17:31 +0000 (16:17 -0600)
lightning/src/routing/router.rs

index 9b308ee00e1bee13e054e06068902950115a26f0..1b54e3a685199c76693f95517ffcbb4c1f503dbf 100644 (file)
@@ -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<S: Score>(
                bench: &mut Bencher, graph: &NetworkGraph, mut scorer: S, features: InvoiceFeatures
        ) {