vy commented on code in PR #3868:
URL: https://github.com/apache/logging-log4j2/pull/3868#discussion_r2269301265


##########
log4j-api/src/main/java/org/apache/logging/log4j/CloseableThreadContext.java:
##########
@@ -206,7 +207,7 @@ public void close() {
         }
 
         private void closeMap() {
-            final Map<String, String> valuesToReplace = new 
HashMap<>(originalValues.size());
+            final Map<String, String> valuesToReplace = 
Maps.newHashMap(originalValues.size());

Review Comment:
   Since Log4j 2 supports Java 8, we don’t really have the concept of internal 
packages — everything is effectively available for use. Once we introduce a 
public class, it’s unlikely we’ll be able to remove it later (see [Hyrum’s 
Law](https://www.hyrumslaw.com/)).
   
   I’m generally not in favor of optimizing `HashMap` resizing unless there’s a 
clear benefit, with the exception of `CloseableThreadContext`, where a simple 
inline math operation achieves the goal cleanly.
   
   In short, I’m leaning `-0` on the PR in its current state. Your perspective 
is just as important as mine, so I’m happy to leave the final call to you.
   



-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to