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 protocol #2161

Closed
wants to merge 1 commit into from
Closed

Perf protocol #2161

wants to merge 1 commit into from

Conversation

MarcoPolo
Copy link
Collaborator

Implements libp2p/specs#478

p2p/protocol/perf/perf.go Show resolved Hide resolved

}

func (ps *PerfService) sendBytes(ctx context.Context, s network.Stream, bytesToSend uint64, buf []byte) error {
Copy link
Contributor

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.

Copy link
Collaborator Author

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)
Copy link
Contributor

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.

@mxinden
Copy link
Member

mxinden commented Jun 22, 2023

With libp2p/test-plans#184 merged, we now have a libp2p-perf protocol implementation on top of go-libp2p in libp2p/test-plans. Thus this pull request can be closed @MarcoPolo, right?

@p-shahi
Copy link
Member

p-shahi commented Jun 28, 2023

Was about to come in and ask the same, I believe this can be closed. Please re-open if it shouldn't be

@p-shahi p-shahi closed this Jun 28, 2023
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.

4 participants