Skip to content

Conversation

@JoseSK999
Copy link
Contributor

What is the purpose of this pull request?

  • Bug fix (benches)
  • Documentation update
  • New feature
  • Test
  • Other:

Which crates are being modified?

  • floresta-chain (benches)
  • floresta-cli
  • floresta-common
  • floresta-compact-filters
  • floresta-electrum
  • floresta-watch-only
  • floresta-wire
  • floresta
  • florestad
  • Other:

Description

Both our accept_header and connect_block methods have early return cases for when we already have the header or have validated the block.

Hence the benches that used a single chainstate for all bencher iterations will use these early return cases. I have used the iter_batched method to set up the chainstate for every bencher iteration (excluded for the measurement), which makes them accurate now.

Notes to the reviewers

Also useful to avoid re-calling connect_block for already validated blocks, which we expect to make invalid after #488

@JoseSK999
Copy link
Contributor Author

In fact the benches were literally telling us exactly this, we were doing an expensive iteration and the rest of them were super fast in comparison. After the change (second picture), we see that iteration time is more consistent.

Captura de pantalla 2025-05-19 a las 21 27 12 Captura de pantalla 2025-05-19 a las 21 27 01

Both our `accept_header` and `connect_block` methods have early return cases for when we already have the header or have validated the block.

Hence the benches that used a single chainstate for all bencher iterations will use these early return cases. I have used the `iter_batched` method to set up the chainstate for every bencher iteration (excluded for the measurement), which makes them accurate now.
@JoseSK999 JoseSK999 force-pushed the use-fresh-chainstates-at-benches branch from ba687d3 to c79b682 Compare May 20, 2025 11:01
Copy link
Member

@Davidson-Souza Davidson-Souza left a comment

Choose a reason for hiding this comment

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

ACK c79b682

@Davidson-Souza Davidson-Souza merged commit 9d6f75c into vinteumorg:master May 20, 2025
10 checks passed
@JoseSK999 JoseSK999 deleted the use-fresh-chainstates-at-benches branch May 20, 2025 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants