[ISSUE #7868] Use entrySet to close channel#7869
Merged
RongtongJin merged 1 commit intoapache:developapache/rocketmq:developfrom Feb 29, 2024
ChineseTony:use_entryset_foreachChineseTony/rocketmq:use_entryset_foreachCopy head branch name to clipboard
Merged
[ISSUE #7868] Use entrySet to close channel#7869RongtongJin merged 1 commit intoapache:developapache/rocketmq:developfrom ChineseTony:use_entryset_foreachChineseTony/rocketmq:use_entryset_foreachCopy head branch name to clipboard
RongtongJin merged 1 commit intoapache:developapache/rocketmq:developfrom
ChineseTony:use_entryset_foreachChineseTony/rocketmq:use_entryset_foreachCopy head branch name to clipboard
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7869 +/- ##
=============================================
- Coverage 42.95% 42.93% -0.03%
- Complexity 9913 9916 +3
=============================================
Files 1190 1190
Lines 86016 86017 +1
Branches 11080 11080
=============================================
- Hits 36948 36929 -19
- Misses 44495 44522 +27
+ Partials 4573 4566 -7 ☔ View full report in Codecov by Sentry. |
Contributor
|
Do you have any statistical support for this enhancement? |
Contributor
Author
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@BenchmarkMode(Mode.Throughput)
@Warmup(iterations = 3, time = 1)
@Measurement(iterations = 5, time = 3)
@Fork(1)
@State(value = Scope.Benchmark)
@OutputTimeUnit(TimeUnit.SECONDS)
public class MapUtil {
private Map<String, String> map = new HashMap<>();
@Setup
public void setup() {
for (int i = 0; i < 8000; i++) {
map.put(i + "", i + "");
}
}
@Benchmark
@Threads(8)
public void keySetMap() {
keySet();
}
@Benchmark
@Threads(8)
public void entrySetMap() {
entrySet();
}
private void entrySet() {
for (Map.Entry<String, String> entry : map.entrySet()) {
entry.getValue();
}
}
private void keySet() {
for (String key : map.keySet()) {
map.get(key);
}
}
}Benchmark Mode Cnt Score Error Units |
RongtongJin
approved these changes
Feb 29, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Fixes #7868
Brief Description
How Did You Test This Change?