rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Better Encapsulate Scoring and Cache Point Count

Open TheBlueMatt opened this issue 1 year ago • 1 comments

When we go to score a channel using the historical liquidity data, the first thing we do is step through all the valid bucket combinations, multiply the min and max bucket, and then add them together to calculate the total number of points tracked. This isn't a free operation, and for scorers without much data it represents a large part of the total time spent scoring during routefinding.

Thus, here we cache this value, updating it every time the buckets are updated. In order to do so, we first have to clean up scorer.rs, which has been needed for some time anyway, improving encapsulation so that caching is more reasonable.

TheBlueMatt avatar Jul 17 '24 14:07 TheBlueMatt

Codecov Report

Attention: Patch coverage is 95.23810% with 8 lines in your changes missing coverage. Please review.

Project coverage is 89.70%. Comparing base (ccce9d9) to head (4fd07ec). Report is 23 commits behind head on main.

Files Patch % Lines
lightning/src/routing/scoring.rs 94.32% 8 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3188      +/-   ##
==========================================
+ Coverage   89.68%   89.70%   +0.01%     
==========================================
  Files         124      125       +1     
  Lines      102386   102458      +72     
  Branches   102386   102458      +72     
==========================================
+ Hits        91827    91912      +85     
+ Misses       7857     7843      -14     
- Partials     2702     2703       +1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jul 17 '24 15:07 codecov[bot]

LMK if I should squash.

TheBlueMatt avatar Aug 15 '24 00:08 TheBlueMatt

Yup, feel free to squash.

arik-so avatar Aug 15 '24 07:08 arik-so

Squashed without further changes.

TheBlueMatt avatar Aug 15 '24 13:08 TheBlueMatt

Rewrote the last commit message but didn't change the diff at all.

TheBlueMatt avatar Aug 16 '24 13:08 TheBlueMatt

Rebased

TheBlueMatt avatar Aug 19 '24 14:08 TheBlueMatt