JBS issue opened for https://github.com/openjdk/jdk/pull/15354
- Avoid allocating StringBuilder when there are no characters in the URL that need to be encoded;
- Implement a fast path for UTF-8.
In addition to improving performance, these optimizations also reduce temporary objects:
- It no longer allocates any object when there are no characters in the URL that need to be encoded;
- The initial size of StringBuilder is larger to avoid expansion as much as possible;
- For UTF-8, the temporary CharArrayWriter, strings and byte arrays are no longer needed.
- Avoid allocating StringBuilder when there are no characters in the URL that need to be encoded;
- Implement a fast path for UTF-8.
In addition to improving performance, these optimizations also reduce temporary objects:
- It no longer allocates any object when there are no characters in the URL that need to be encoded;
- The initial size of StringBuilder is larger to avoid expansion as much as possible;
- For UTF-8, the temporary CharArrayWriter, strings and byte arrays are no longer needed.