> I mainly made these optimizations:
> 
> * Avoid allocating `StringBuilder` when there are no characters in the URL 
> that need to be encoded;
> * ~Implement a fast path for UTF-8.~ (Has been removed from this PR)
> 
> 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.~ (Has been removed from this PR)
> 
> I also updated the tests to add more test cases.

Glavo has updated the pull request incrementally with one additional commit 
since the last revision:

  Update src/java.base/share/classes/java/net/URLEncoder.java
  
  Co-authored-by: Claes Redestad <[email protected]>

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/15354/files
  - new: https://git.openjdk.org/jdk/pull/15354/files/a2cb7b30..9eb12c8e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=15354&range=12
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15354&range=11-12

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/15354.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15354/head:pull/15354

PR: https://git.openjdk.org/jdk/pull/15354

Reply via email to