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

[Enhancement] Some optimizations for collections #2702

Closed
1 of 2 tasks
Alonexc opened this issue Dec 29, 2022 · 2 comments
Closed
1 of 2 tasks

[Enhancement] Some optimizations for collections #2702

Alonexc opened this issue Dec 29, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Issues for first-time contributors
Milestone

Comments

@Alonexc
Copy link
Contributor

Alonexc commented Dec 29, 2022

Search before asking

  • I had searched in the issues and found no similar issues.

Enhancement Request

image
located at:
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/recommend/EventMeshRecommendImpl.java line 114,116,126,201,207

Describe the solution you'd like

  1. Iteration call can be replaced with parametrized constructor call
  2. Collections.sort could be replaced with List.sort
    reference:
    image

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@Alonexc Alonexc added the enhancement New feature or request label Dec 29, 2022
@xwm1992 xwm1992 added the good first issue Issues for first-time contributors label Dec 29, 2022
@mvadharia
Copy link
Contributor

mvadharia commented Jan 4, 2023

Hi @xwm1992 @Alonexc , seems like this issue has already fixed and code has been updated.
But I do have a suggestion on EventMeshRecommendImpl line 172 in recommendProxy() method, instead of looping through keys, retainAll method of Set after retrieving keySet() from Map, can be used to check if there exists a key in clientDistributionMap but not in eventMeshMap and vice versa if required insteading of looping through entire keySet.
I can raise PR for the improvement I mentioned and we can close this issue once done.

@Alonexc
Copy link
Contributor Author

Alonexc commented Jan 6, 2023

Hi @xwm1992 @Alonexc , seems like this issue has already fixed and code has been updated. But I do have a suggestion on EventMeshRecommendImpl line 172 in recommendProxy() method, instead of looping through keys, retainAll method of Set after retrieving keySet() from Map, can be used to check if there exists a key in clientDistributionMap but not in eventMeshMap and vice versa if required insteading of looping through entire keySet. I can raise PR for the improvement I mentioned and we can close this issue once done.

@mvadharia Ok, I see that it has been fixed and I will close the issue.

@Alonexc Alonexc closed this as completed Jan 6, 2023
@xwm1992 xwm1992 added this to the 1.8.0 milestone Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Issues for first-time contributors
Projects
None yet
Development

No branches or pull requests

3 participants