Skip to content

Perf protocol#2161

Closed
MarcoPolo wants to merge 1 commit into
masterfrom
marco/perf
Closed

Perf protocol#2161
MarcoPolo wants to merge 1 commit into
masterfrom
marco/perf

Conversation

@MarcoPolo
Copy link
Copy Markdown
Collaborator

Implements libp2p/specs#478

Comment thread p2p/protocol/perf/perf.go
Comment thread p2p/protocol/perf/perf.go

}

func (ps *PerfService) sendBytes(ctx context.Context, s network.Stream, bytesToSend uint64, buf []byte) error {
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread p2p/protocol/perf/perf.go
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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