]> git.bitcoin.ninja Git - rust-lightning/commitdiff
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, 3 Feb 2022 02:22:27 +0000 (20:22 -0600)
lightning/src/routing/router.rs

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