Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(latency-tests): reissue more notes #4587

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

dpc
Copy link
Contributor

@dpc dpc commented Mar 16, 2024

Reissuing is so fast now, that it's hard to bench any potential improvements. Issue more notes, to make it work harder.

In my tests, when using ci build profile:

Before:

LATENCY REISSUE: min: 0.6s, avg: 0.7s, median: 0.6s, p90: 0.7s, max: 0.7s, sum: 19.5s

Now:

LATENCY REISSUE: min: 1.3s, avg: 1.4s, median: 1.4s, p90: 1.5s, max: 1.5s, sum: 42.4s

Reissuing is so fast, that it's hard to bench any potential improvements.
Issue more notes, to make it work harder.

In my tests, when using `ci` build profile:

Before:

LATENCY REISSUE: min: 0.6s, avg: 0.7s, median: 0.6s, p90: 0.7s, max: 0.7s, sum: 19.5s

Now:

LATENCY REISSUE: min: 1.3s, avg: 1.4s, median: 1.4s, p90: 1.5s, max: 1.5s, sum: 42.4s
@dpc dpc requested a review from a team as a code owner March 16, 2024 22:16
@@ -132,8 +133,13 @@ pub async fn latency_tests(dev_fed: DevFed, r#type: LatencyTest) -> Result<()> {
// for enough time to catch up a session end
let iterations = 30;
let mut reissues = Vec::with_capacity(iterations);
let amount_per_iteration_msats =
// use a highest 2^-1 amount that fits, to try to use as many notes as possible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 2^x-1

@@ -132,8 +133,13 @@ pub async fn latency_tests(dev_fed: DevFed, r#type: LatencyTest) -> Result<()> {
// for enough time to catch up a session end
let iterations = 30;
let mut reissues = Vec::with_capacity(iterations);
let amount_per_iteration_msats =
// use a highest 2^-1 amount that fits, to try to use as many notes as possible
((initial_balance_sats * 1000 / iterations as u64).next_power_of_two() >> 1) - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about next_power_of_two 🤯

Note that this might blow up if we ever switch away from base-2 denominations as the default. The only commitment we made and assume everywhere is that denominations are b^x.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it should fail gracefully, just not issuing as many notes anymore.

@elsirion elsirion added this pull request to the merge queue Mar 18, 2024
Merged via the queue into fedimint:master with commit 9f574c9 Mar 18, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants