theigl commented on code in PR #579:
URL: https://github.com/apache/wicket/pull/579#discussion_r1168248756


##########
wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java:
##########
@@ -1089,7 +1089,7 @@ public static CharSequence toMultilineMarkup(final 
CharSequence s)
                        return null;
                }
 
-               final AppendingStringBuffer buffer = new 
AppendingStringBuffer();
+               final AppendingStringBuffer buffer = new 
AppendingStringBuffer((int) (s.length() * 1.1));

Review Comment:
   I just realized that this has an adverse effect on short strings where the 
overhead of `<p></p>` is significantly more than 10%. It makes sense to set a 
minimum capacity for the buffer. Either via `Math.max((int)(len * 1.1), 16)` or 
by always adding the default capacity of 16 to the length.



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