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

[ISSUE #7534] use high performance concurrent set to replace copyonwriteset #7583

Merged
merged 3 commits into from
Dec 1, 2023

Conversation

keranbingaa
Copy link
Contributor

@keranbingaa keranbingaa commented Nov 27, 2023

fix #7534

Copy link
Contributor

@RongtongJin RongtongJin left a comment

Choose a reason for hiding this comment

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

image
Plz pass the code-style.

Set<String> copyOnWriteArraySet = new CopyOnWriteArraySet<>();
HashSet<String> topics= new HashSet<>();

for(int i=0; i< 100000 ; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

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

seems that this line need to be reformatted

@codecov-commenter
Copy link

codecov-commenter commented Nov 30, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (e955e43) 43.17% compared to head (5901b4e) 43.21%.
Report is 4 commits behind head on develop.

Files Patch % Lines
...che/rocketmq/remoting/protocol/body/TopicList.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #7583      +/-   ##
=============================================
+ Coverage      43.17%   43.21%   +0.04%     
- Complexity      9780     9787       +7     
=============================================
  Files           1162     1162              
  Lines          84303    84378      +75     
  Branches       10949    10955       +6     
=============================================
+ Hits           36396    36466      +70     
+ Misses         43386    43382       -4     
- Partials        4521     4530       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 137 to 154
@Test
public void hugeTopicListAddTest() {
Set<String> mapSet = ConcurrentHashMap.newKeySet();
Set<String> copyOnWriteArraySet = new CopyOnWriteArraySet<>();
HashSet<String> topics = new HashSet<>();

for (int i = 0; i < 100000; ++i) {
topics.add("Topic" + i);
}
long startTime = System.currentTimeMillis();
mapSet.addAll(topics);
long endTime = System.currentTimeMillis();
assertThat(endTime - startTime < 100).isTrue();
startTime = System.currentTimeMillis();
copyOnWriteArraySet.addAll(topics);
endTime = System.currentTimeMillis();
assertThat(endTime - startTime > 3000).isTrue();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that this test is unnecessary

@RongtongJin RongtongJin merged commit 65faea2 into apache:develop Dec 1, 2023
10 checks passed
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.

[Bug] class Topiclist use CopyOnWriteArraySet will cause timeout
4 participants