-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 protocol #2161
Perf protocol #2161
Conversation
|
||
} | ||
|
||
func (ps *PerfService) sendBytes(ctx context.Context, s network.Stream, bytesToSend uint64, buf []byte) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easier to read if you allocate buf
in this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You then have to allocate the buf twice in the send and drain paths. Yes, I know this is a pool, but you still do the put and get work.
func (ps *PerfService) drainStream(ctx context.Context, s network.Stream, buf []byte) (uint64, error) { | ||
var recvd uint64 | ||
for { | ||
n, err := s.Read(buf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can copy into io.Discard.
With libp2p/test-plans#184 merged, we now have a libp2p-perf protocol implementation on top of go-libp2p in |
Was about to come in and ask the same, I believe this can be closed. Please re-open if it shouldn't be |
Implements libp2p/specs#478