multistream-select: Less allocations.#800
Merged
Merged
Conversation
tomaka
approved these changes
Jan 9, 2019
| proto_name: I::Item, | ||
| protocols: I | ||
| }, | ||
| SendProtocol { |
Member
There was a problem hiding this comment.
I think this should mention that this is in fact a Flush. Either change the current confusing name or add a comment.
Member
|
Tested on Substrate, seems to work just fine. |
`SendProtocol` -> `FlushProtocol` `SendListRequest` -> `FlushListRequest`
Member
|
Could you create the issue for removing Clone as well? Since you know more of the context. |
Contributor
Author
|
Done: #836 |
dvdplm
added a commit
to dvdplm/rust-libp2p
that referenced
this pull request
Jan 15, 2019
* upstream/master: (35 commits) Bump libp2p-secio and libp2p-core-derive (libp2p#857) Fixes to Kademlia queries (libp2p#855) Cache the secp256k1 object in secio (libp2p#856) Fix custom derive when using a where clause (libp2p#853) Bump to 0.2.2 (libp2p#852) Bump to v0.2.1 (libp2p#851) Add IntoNodeHandler and IntoProtocolsHandler traits (libp2p#848) Improve doc aesthetics (libp2p#850) Fix compilation of ring (libp2p#846) Add some benchmarks for secio (libp2p#847) Version 0.2 (libp2p#841) Forbid dialing self (libp2p#839) Add an Error associated type to transports (libp2p#835) Update ring to 0.13 (libp2p#674) Move tests to separate files (libp2p#827) multistream-select: Less allocations. (libp2p#800) Add more methods on Topology (libp2p#826) Documentation improve to ping and minor improvements (libp2p#831) Floodsub now produces FloodsubEvent (libp2p#823) Add RawSwarm::incoming_negotiated (libp2p#821) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR attempts to avoid creating intermediate
Bytesvalues when sending protocol names, but instead passes them as is to thetokio_codec::Encoderwhich copies them once into the destination byte buffer.The dialer_select/listener_select state machines sometimes need to duplicate a single protocol name. This PR chose to require
Cloneon an item which is the most straightforward and in most cases (slices,Bytes, etc.) the most performant solution. If this is unwanted I can change this PR to perform reiteration to get the protocol name again, but I wanted to get some feedback first as this is a more complicated solution.