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

Add implementations of prepare_uninitialized_buffer and read_buf where relevant #1107

Merged
merged 4 commits into from
May 10, 2019

Conversation

tomaka
Copy link
Member

@tomaka tomaka commented May 7, 2019

Fixes #1080

Most of the CPU usage is in memcpy (EDIT: and memset), so this should hopefully give a speed boost to the library.
Also adds prepare_uninitialized_buffer to the StreamMuxer trait.

@ghost ghost assigned tomaka May 7, 2019
@ghost ghost added the in progress label May 7, 2019
@@ -80,6 +80,10 @@ where
fn destroy_outbound(&self, _: Self::OutboundSubstream) {
}

unsafe fn prepare_uninitialized_buffer(&self, _: &mut [u8]) -> bool {
false
Copy link
Member Author

@tomaka tomaka May 7, 2019

Choose a reason for hiding this comment

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

@twittner Please confirm that yamux doesn't fetch data from the buffer when you call read (I would be surprised if it did, but you never know).

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as I can tell, it doesn't.

Copy link
Contributor

Choose a reason for hiding this comment

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

Confirmed.

@tomaka tomaka merged commit c2398ad into libp2p:master May 10, 2019
@tomaka tomaka deleted the fix-1080 branch May 10, 2019 09:26
@ghost ghost removed the in progress label May 10, 2019
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.

Implement prepare_uninitialized_buffer and read_buf in our AsyncRead implementations
3 participants