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

chore: short-circuit unnecessary message processing #290

Merged
merged 1 commit into from
Dec 8, 2021

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Dec 2, 2021

@hannahhoward I noticed this when looking at some new traces I'm starting from ReceiveMessage. The majority that come in through here don't have any requests, so going into responseManager.ProcessRequests gets it put into the message handling loop and eventually hit a for loop that iterates over an empty slice and does nothing else. On the other side, requestManager.ProcessResponses has the same thing but even more branches where it hits various for loops to collect and process things over an empty slice when there's no responses or blocks.

So, minor optimisation, but seems to be worthwhile given how chatty this call seems to be.

@rvagg rvagg requested a review from hannahhoward December 2, 2021 06:22
Copy link
Collaborator

@hannahhoward hannahhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rvagg rvagg force-pushed the rvagg/message-shunting branch from 1865483 to 8a576e1 Compare December 8, 2021 05:38
@rvagg rvagg merged commit 8bb121e into main Dec 8, 2021
@rvagg rvagg deleted the rvagg/message-shunting branch December 8, 2021 07:42
marten-seemann pushed a commit that referenced this pull request Mar 2, 2023
* feat(impl): add spans to block events

* fix(deps): update to go-ipfs-blockstore v1.1.2

* refactor(impl): clean up span naming
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.

2 participants