Skip to content

Conversation

@onur-ozkan
Copy link
Contributor

@onur-ozkan onur-ozkan commented Nov 17, 2025

Description

This change improves peer removal during heartbeat by switching from a two-pass remove logic to an in-place retain with very small size intermediate variable removed_peers_count.

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@onur-ozkan onur-ozkan changed the title gossipsub: in-place negative-score peer removal refactor(gossipsub): in-place negative-score peer removal Nov 17, 2025
Copy link
Member

@elenaf9 elenaf9 left a comment

Choose a reason for hiding this comment

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

Thanks

@onur-ozkan onur-ozkan force-pushed the opt-peer-removal-iter branch from ceec87e to 797293e Compare November 18, 2025 17:37
@mergify
Copy link
Contributor

mergify bot commented Nov 18, 2025

This pull request has merge conflicts. Could you please resolve them @onur-ozkan? 🙏

Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Hi, and thanks for looking into it! Since extract_if has been stabilized I think we can use it to make it easier to count the removed peers wdyt?

@onur-ozkan
Copy link
Contributor Author

Hi, and thanks for looking into it! Since extract_if has been stabilized I think we can use it to make it easier to count the removed peers wdyt?

We would need to raise MSRV to very recent version. I am fine with that but I think there will be many downstream users not liking this.

This change improves peer removal during `heartbeat` by switching
from a two-pass remove logic to an in-place `retain` with very small
size intermediate variable `removed_peers_count`.

Signed-off-by: Onur Özkan <[email protected]>
Signed-off-by: Onur Özkan <[email protected]>
@onur-ozkan onur-ozkan force-pushed the opt-peer-removal-iter branch from 797293e to 44cb2c5 Compare November 19, 2025 15:17
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.

3 participants