Skip to content

feat(net) : optimize the sortPeers method#5873

Merged
lvs007 merged 2 commits into
tronprotocol:developfrom
zeusoo001:sortpeers-method-opt
Jul 1, 2024
Merged

feat(net) : optimize the sortPeers method#5873
lvs007 merged 2 commits into
tronprotocol:developfrom
zeusoo001:sortpeers-method-opt

Conversation

@zeusoo001

Copy link
Copy Markdown
Contributor

What does this PR do?
Optimize the sortPeers method, refer to issue: #5849

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@lvs007 lvs007 linked an issue Jun 21, 2024 that may be closed by this pull request
}

public static synchronized void sortPeers() {
peers.sort(Comparator.comparingDouble(c -> c.getChannel().getAvgLatency()));

@317787106 317787106 Jul 1, 2024

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why not use Comparator.comparingLong ? the type of c.getChannel().getAvgLatency() is long

@zeusoo001 zeusoo001 Jul 1, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

get

@lvs007 lvs007 merged commit bcba5c1 into tronprotocol:develop Jul 1, 2024
@zeusoo001 zeusoo001 deleted the sortpeers-method-opt branch August 13, 2024 06:33
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.

IllegalArgumentException appears in the log

5 participants