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


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/impl/JdkMapAdapterStringMap.java:
##########
@@ -47,9 +47,14 @@ public class JdkMapAdapterStringMap implements StringMap {
     private transient String[] sortedKeys;
 
     public JdkMapAdapterStringMap() {
-        this(new HashMap<String, String>());
+        this(new HashMap<String, String>(), false);
     }
 
+    /**
+     * @deprecated for performance reasons since 2.23.
+     *             Use {@link #JdkMapAdapterStringMap(Map, boolean)} instead.
+     */
+    @Deprecated
     public JdkMapAdapterStringMap(final Map<String, String> map) {
         this.map = Objects.requireNonNull(map, "map");
         try {

Review Comment:
   @ppkarwasz, given we are trying to mitigate a performance regression, 
doesn't `HashMap::new` (or `this(map, true)`) create another by replacing the 
one from `try-catch`? I mean, are these significantly faster than `try-catch`?



-- 
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