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

perf(net): P2P sink, revert pull/11658 #11712

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

emhane
Copy link
Member

@emhane emhane commented Oct 14, 2024

Closes #11677

Reverts #11658

@emhane emhane added C-perf A change motivated by improving speed, memory usage or disk footprint A-networking Related to networking in general labels Oct 14, 2024
@github-actions github-actions bot added the C-enhancement New feature or request label Oct 14, 2024
Comment on lines +617 to +618
let poll_res = loop {
match this.inner.as_mut().poll_ready(cx) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this loop is actually redundant.

as described in the issue I'd like to solve this differently, because this currently also doesn't really make use of the framed buffer, so I don't really want to revert this again but improve it instead

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see how it doesn't make use of the framed buffer?

Copy link
Member Author

Choose a reason for hiding this comment

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

Framed wraps FramedImpl

https://docs.rs/tokio-util/latest/src/tokio_util/codec/framed.rs.html#17-41

this is how FramedImpl implements poll_ready, it flushes if enough messages are buffered to fill a frame

https://docs.rs/tokio-util/latest/src/tokio_util/codec/framed_impl.rs.html#261-267

poll_flush impl for P2PStream, calls poll_flush on framed explicitly before returning to make sure all messages are sent. this last frame may be partly full.

@emhane emhane requested a review from mattsse October 14, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-networking Related to networking in general C-enhancement New feature or request C-perf A change motivated by improving speed, memory usage or disk footprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve P2PStream sink logic
2 participants