Skip to content

Commit ba8d084

Browse files
committed
Benchmark zero-penalty scorer
1 parent 20f41df commit ba8d084

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4978,6 +4978,15 @@ mod benches {
49784978
fn log(&self, _record: &Record) {}
49794979
}
49804980

4981+
struct ZeroPenaltyScorer;
4982+
impl Score for ZeroPenaltyScorer {
4983+
fn channel_penalty_msat(
4984+
&self, _short_channel_id: u64, _send_amt: u64, _capacity_msat: Option<u64>, _source: &NodeId, _target: &NodeId
4985+
) -> u64 { 0 }
4986+
fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
4987+
fn payment_path_successful(&mut self, _path: &[&RouteHop]) {}
4988+
}
4989+
49814990
fn read_network_graph() -> NetworkGraph {
49824991
let mut d = test_utils::get_route_file().unwrap();
49834992
NetworkGraph::read(&mut d).unwrap()
@@ -5017,6 +5026,20 @@ mod benches {
50175026
}
50185027
}
50195028

5029+
#[bench]
5030+
fn generate_routes_with_zero_penalty_scorer(bench: &mut Bencher) {
5031+
let network_graph = read_network_graph();
5032+
let scorer = ZeroPenaltyScorer;
5033+
generate_routes(bench, &network_graph, scorer, InvoiceFeatures::empty());
5034+
}
5035+
5036+
#[bench]
5037+
fn generate_mpp_routes_with_zero_penalty_scorer(bench: &mut Bencher) {
5038+
let network_graph = read_network_graph();
5039+
let scorer = ZeroPenaltyScorer;
5040+
generate_routes(bench, &network_graph, scorer, InvoiceFeatures::known());
5041+
}
5042+
50205043
#[bench]
50215044
fn generate_routes_with_default_scorer(bench: &mut Bencher) {
50225045
let network_graph = read_network_graph();

0 commit comments

Comments
 (0)