Re: RFR: 8271732: Regression in StringBuilder.charAt bounds checking [v4]

2021-08-12 Thread Alan Bateman
On Wed, 11 Aug 2021 21:40:52 GMT, Claes Redestad  wrote:

>> In #4738 we removed the `checkIndex(value, count)` call in `ASB.charAt` to 
>> avoid potentially getting two bounds checks in the UTF-16 case. Problem is 
>> this optimization cause a regression since `StringUTF16.charAt(..)` checks 
>> `index` against the length of the `value` array and not `count`.
>> 
>> A correct fix that still maintain the possible performance advantage 
>> reported by #4738 is to reinstate the `checkIndex(value, count)` and call 
>> `StringUTF16.getChar` instead of `charAt`.
>
> Claes Redestad has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fix copy-paste error

Marked as reviewed by alanb (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/5086


Re: RFR: 8271732: Regression in StringBuilder.charAt bounds checking [v4]

2021-08-11 Thread Naoto Sato
On Wed, 11 Aug 2021 21:40:52 GMT, Claes Redestad  wrote:

>> In #4738 we removed the `checkIndex(value, count)` call in `ASB.charAt` to 
>> avoid potentially getting two bounds checks in the UTF-16 case. Problem is 
>> this optimization cause a regression since `StringUTF16.charAt(..)` checks 
>> `index` against the length of the `value` array and not `count`.
>> 
>> A correct fix that still maintain the possible performance advantage 
>> reported by #4738 is to reinstate the `checkIndex(value, count)` and call 
>> `StringUTF16.getChar` instead of `charAt`.
>
> Claes Redestad has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fix copy-paste error

Marked as reviewed by naoto (Reviewer).

-

PR: https://git.openjdk.java.net/jdk/pull/5086


Re: RFR: 8271732: Regression in StringBuilder.charAt bounds checking [v4]

2021-08-11 Thread Claes Redestad
> In #4738 we removed the `checkIndex(value, count)` call in `ASB.charAt` to 
> avoid potentially getting two bounds checks in the UTF-16 case. Problem is 
> this optimization cause a regression since `StringUTF16.charAt(..)` checks 
> `index` against the length of the `value` array and not `count`.
> 
> A correct fix that still maintain the possible performance advantage reported 
> by #4738 is to reinstate the `checkIndex(value, count)` and call 
> `StringUTF16.getChar` instead of `charAt`.

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

  Fix copy-paste error

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5086/files
  - new: https://git.openjdk.java.net/jdk/pull/5086/files/4ef9ccbc..83a64828

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=5086=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=5086=02-03

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

PR: https://git.openjdk.java.net/jdk/pull/5086