reta commented on a change in pull request #696:
URL: https://github.com/apache/cxf/pull/696#discussion_r493102424



##########
File path: 
core/src/main/java/org/apache/cxf/interceptor/ServiceInvokerInterceptor.java
##########
@@ -62,7 +62,7 @@ public void run() {
 
                     Message outMessage = runableEx.getOutMessage();
                     if (outMessage == null) {
-                        outMessage = new MessageImpl();
+                        outMessage = new MessageImpl(16, 1); // perf: size 16 
/ factor 1 to avoid resize operation

Review comment:
       Sorry @andymc12 , just of of curiosity, the MessageImpl is a HashMap and 
uses its default constructor, where capacity is set to `16` and load factor to 
`0.75`.
   
   ```
   /**
        * Constructs an empty <tt>HashMap</tt> with the default initial capacity
        * (16) and the default load factor (0.75).
        */
       public HashMap() {
           this.loadFactor = DEFAULT_LOAD_FACTOR; // all other fields defaulted
       }
   ```
   
   You guys found out that load factor of `1` helps to eliminate unnecessary 
resizing (probably because the size of the message container is around 16 
elements)?




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

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


Reply via email to