-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set<String> copyOnWriteArraySet = new CopyOnWriteArraySet<>(); | ||
HashSet<String> topics= new HashSet<>(); | ||
|
||
for(int i=0; i< 100000 ; ++i) { |
There was a problem hiding this comment.
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 ReportAttention:
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. |
@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(); | ||
} |
There was a problem hiding this comment.
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
fix #7534