Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Сергей Цыпанов
On Wed, 13 Jan 2021 13:48:40 GMT, Claes Redestad wrote: >> Сергей Цыпанов has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains five additional >> com

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Chris Hegarty
On Thu, 14 Jan 2021 12:48:18 GMT, Сергей Цыпанов wrote: >> Instead of allocating a copy of underlying array via >> `CharArrayWriter.toCharArray()` and passing it to constructor of String >> String str = new String(charArrayWriter.toCharArray()); >> we could call `toString()` method >> String st

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Claes Redestad
On Thu, 14 Jan 2021 11:48:16 GMT, Claes Redestad wrote: >> @cl4es SB brings pessimization both for time and memory, try >> `org.openjdk.bench.java.net.URLEncodeDecode`: >> master >> (count) (maxLength) >> (mySeed) Mode Cnt Score

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v3]

2021-01-14 Thread Сергей Цыпанов
> Instead of allocating a copy of underlying array via > `CharArrayWriter.toCharArray()` and passing it to constructor of String > String str = new String(charArrayWriter.toCharArray()); > we could call `toString()` method > String str = charArrayWriter.toString(); > decoding existing char[] witho

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v2]

2021-01-14 Thread Claes Redestad
On Thu, 14 Jan 2021 09:31:19 GMT, Сергей Цыпанов wrote: >> Looks good. >> >> I wonder... `CharArrayWriter` is an old and synchronized data structure, and >> since the instance used here isn't shared that synchronization seem useless. >> And since you're now bypassing the `char[]` and going st

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset) [v2]

2021-01-14 Thread Сергей Цыпанов
> Instead of allocating a copy of underlying array via > `CharArrayWriter.toCharArray()` and passing it to constructor of String > String str = new String(charArrayWriter.toCharArray()); > we could call `toString()` method > String str = charArrayWriter.toString(); > decoding existing char[] witho

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-14 Thread Сергей Цыпанов
On Wed, 13 Jan 2021 13:48:40 GMT, Claes Redestad wrote: >> Instead of allocating a copy of underlying array via >> `CharArrayWriter.toCharArray()` and passing it to constructor of String >> String str = new String(charArrayWriter.toCharArray()); >> we could call `toString()` method >> String str

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-13 Thread Сергей Цыпанов
On Wed, 13 Jan 2021 13:48:40 GMT, Claes Redestad wrote: >> Instead of allocating a copy of underlying array via >> `CharArrayWriter.toCharArray()` and passing it to constructor of String >> String str = new String(charArrayWriter.toCharArray()); >> we could call `toString()` method >> String str

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-13 Thread Claes Redestad
On Thu, 3 Dec 2020 14:29:58 GMT, Сергей Цыпанов wrote: > Instead of allocating a copy of underlying array via > `CharArrayWriter.toCharArray()` and passing it to constructor of String > String str = new String(charArrayWriter.toCharArray()); > we could call `toString()` method > String str = ch

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-13 Thread Attila Szegedi
On Thu, 3 Dec 2020 14:29:58 GMT, Сергей Цыпанов wrote: > Instead of allocating a copy of underlying array via > `CharArrayWriter.toCharArray()` and passing it to constructor of String > String str = new String(charArrayWriter.toCharArray()); > we could call `toString()` method > String str = ch

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-13 Thread Attila Szegedi
On Mon, 11 Jan 2021 09:28:46 GMT, Сергей Цыпанов wrote: >> Looks good! > > @szegedi could you please create a ticket for this change? Otherwise I cannot > merge it Filed a ticket, you should rename this PR to "8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)"

Re: RFR: 8259699: Reduce char[] copying in URLEncoder.encode(String, Charset)

2021-01-13 Thread Сергей Цыпанов
On Sun, 10 Jan 2021 20:13:51 GMT, Attila Szegedi wrote: >> Instead of allocating a copy of underlying array via >> `CharArrayWriter.toCharArray()` and passing it to constructor of String >> String str = new String(charArrayWriter.toCharArray()); >> we could call `toString()` method >> String str