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

Parallelizing Swarm<T>.PreloadAsync() #846

Merged
merged 1 commit into from
Apr 10, 2020

Conversation

longfin
Copy link
Member

@longfin longfin commented Apr 9, 2020

This PR increases the performance of Swarm<T>.PreloadAsync() by parallelizing DialToExistingPeers().

@longfin longfin self-assigned this Apr 9, 2020
@longfin longfin marked this pull request as ready for review April 9, 2020 14:25
@codecov
Copy link

codecov bot commented Apr 9, 2020

Codecov Report

Merging #846 into master will decrease coverage by 0.01%.
The diff coverage is 63.63%.

@@            Coverage Diff             @@
##           master     #846      +/-   ##
==========================================
- Coverage   87.51%   87.50%   -0.02%     
==========================================
  Files         249      249              
  Lines       22601    22620      +19     
==========================================
+ Hits        19779    19793      +14     
- Misses       1477     1481       +4     
- Partials     1345     1346       +1     
Impacted Files Coverage Δ
Libplanet/Net/Swarm.cs 84.99% <63.63%> (-0.01%) ⬇️
Libplanet.Tests/Net/Protocols/TestTransport.cs 76.68% <0.00%> (-0.62%) ⬇️

earlbread
earlbread previously approved these changes Apr 10, 2020
{
return (peer, pong);
}
})
Copy link
Contributor

Choose a reason for hiding this comment

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

How about adding the cancellationToken to ContinueWith?

}

return t.Result.Where(pair => !(pair.Item1 is null)).ToArray();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

How about adding the cancellationToken to ContinueWith?

else if (!(t.Result is Pong pong))
{
// Mark to skip
return (null, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

How about combining these multiple conditions into one?

@longfin
Copy link
Member Author

longfin commented Apr 10, 2020

Amended a commit to applying the suggestion (7d7bf04)

@longfin longfin requested a review from earlbread April 10, 2020 02:44
@longfin longfin added the network Related to networking (Libplanet.Net) label Apr 10, 2020
@longfin longfin merged commit 73ce4f5 into planetarium:master Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
network Related to networking (Libplanet.Net)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants