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

avoid redundant memcopy in node_buffer::get_nodes #23

Merged
merged 2 commits into from Aug 22, 2016

Conversation

Projects
None yet
2 participants
@arvidn
Contributor

arvidn commented Aug 21, 2016

Instead of heap allocating a string and copying nodes into, this patch makes node_buffer::get_nodes() return 2 ranges of bytes to be copied into the packet. This avoids heap allocations entirely and saves at least one memcopy for all node data.

@arvidn

This comment has been minimized.

Show comment
Hide comment
Contributor

arvidn commented Aug 21, 2016

@arvidn

This comment has been minimized.

Show comment
Hide comment
@arvidn
Contributor

arvidn commented Aug 22, 2016

Show outdated Hide outdated node_buffer.hpp
@ssiloti

This comment has been minimized.

Show comment
Hide comment
@ssiloti

ssiloti Aug 22, 2016

Contributor

lgtm

Contributor

ssiloti commented Aug 22, 2016

lgtm

@arvidn arvidn merged commit 1222e75 into bittorrent:master Aug 22, 2016

@arvidn arvidn deleted the arvidn:node-buffer_optimization branch Aug 22, 2016

@arvidn

This comment has been minimized.

Show comment
Hide comment
@arvidn

arvidn Aug 23, 2016

Contributor

actually, changing that comparison operator made the unit test fail. I'll fix that in-place in the master branch (since I already merged it)

Contributor

arvidn commented Aug 23, 2016

actually, changing that comparison operator made the unit test fail. I'll fix that in-place in the master branch (since I already merged it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment