RongtongJin commented on code in PR #10461:
URL: https://github.com/apache/rocketmq/pull/10461#discussion_r3392968856


##########
proxy/src/main/java/org/apache/rocketmq/proxy/common/ProxyContext.java:
##########
@@ -23,7 +23,8 @@
 
 public class ProxyContext {
     public static final String INNER_ACTION_PREFIX = "Inner";
-    private final Map<String, Object> value = new HashMap<>();
+    private static final int DEFAULT_INITIAL_CAPACITY = 64;
+    private final Map<String, Object> value = new 
HashMap<>(DEFAULT_INITIAL_CAPACITY);

Review Comment:
   The change looks behaviorally safe, but the rationale should be tightened. 
Current built-in initialization does not always cross the default HashMap 
resize threshold: gRPC usually sets about 8 entries, or 9 with a deadline, and 
Remoting usually sets about 5-8 depending on available channel attributes. 
Resize mainly happens if later pipeline/interceptor/plugin entries add more 
values. Consider either using a smaller initial capacity such as 32, or keeping 
64 while updating the PR description to frame this as headroom for extended 
contexts rather than a deterministic resize on every request.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to