This is an automated email from the ASF dual-hosted git repository. orpiske pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 21875c0be05178803c5278eded15cd16ecb7f7d6 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Wed May 24 11:55:50 2023 +0200 (chores) camel-util: use an slightly larger buffer size by default By default, StringBuffer has an internal buffer of 16 chars. Our keys and values may usually be larger that, therefore, start with a value slightly larger to avoid resizing the array in most cases. --- .../src/main/java/org/apache/camel/util/URIScanner.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/camel-util/src/main/java/org/apache/camel/util/URIScanner.java b/core/camel-util/src/main/java/org/apache/camel/util/URIScanner.java index d965d4a9ed1..c387e89c985 100644 --- a/core/camel-util/src/main/java/org/apache/camel/util/URIScanner.java +++ b/core/camel-util/src/main/java/org/apache/camel/util/URIScanner.java @@ -43,8 +43,12 @@ class URIScanner { private char rawTokenEnd; URIScanner() { - this.key = new StringBuilder(); - this.value = new StringBuilder(); + /* + * By default, StringBuffer has an internal buffer of 16 chars. Our keys and values may usually be larger than, + * therefore, start with a value slightly larger than default to avoid resizing the array in most cases. + */ + this.key = new StringBuilder(32); + this.value = new StringBuilder(32); } private void initState() {