On Wed, 13 Jul 2022 15:11:25 GMT, Сергей Цыпанов <d...@openjdk.org> wrote:

>> We can skip bounds check and null check for Charset in case we use the array 
>> entirely and the Charset is either default one or proven to be non-null.
>> 
>> Benchmark results:
>> 
>> before
>> 
>> Benchmark                                                  Mode  Cnt  Score  
>>  Error  Units
>> StringConstructor.newStringFromArray                       avgt   50  4,815 
>> ± 0,154  ns/op
>> StringConstructor.newStringFromArrayWithCharset            avgt   50  4,462 
>> ± 0,068  ns/op
>> StringConstructor.newStringFromArrayWithCharsetName        avgt   50  8,653 
>> ± 0,040  ns/op
>> StringConstructor.newStringFromRangedArray                 avgt   50  5,090 
>> ± 0,066  ns/op
>> StringConstructor.newStringFromRangedArrayWithCharset      avgt   50  4,550 
>> ± 0,041  ns/op
>> StringConstructor.newStringFromRangedArrayWithCharsetName  avgt   50  8,080 
>> ± 0,055  ns/op
>> 
>> after
>> 
>> Benchmark                                                  Mode  Cnt  Score  
>>  Error  Units
>> StringConstructor.newStringFromArray                       avgt   50  4,595 
>> ± 0,053  ns/op
>> StringConstructor.newStringFromArrayWithCharset            avgt   50  4,038 
>> ± 0,062  ns/op
>> StringConstructor.newStringFromArrayWithCharsetName        avgt   50  8,035 
>> ± 0,031  ns/op
>> StringConstructor.newStringFromRangedArray                 avgt   50  4,084 
>> ± 0,007  ns/op
>> StringConstructor.newStringFromRangedArrayWithCharset      avgt   50  4,014 
>> ± 0,008  ns/op
>> StringConstructor.newStringFromRangedArrayWithCharsetName  avgt   50  7,466 
>> ± 0,071  ns/op
>
> Сергей Цыпанов 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 six additional 
> commits since the last revision:
> 
>  - 8289908: Rework constructor
>  - Merge branch 'master' into 8289908
>  - 8289908: Fixed tests
>  - Merge branch 'master' into 8289908
>  - 8289908: Make constructor private and use trailing Void instead of int
>  - 8289908: Skip bounds check for cases when String is constructed from 
> entirely used byte[]

Looks good, thanks for the updates.

src/java.base/share/classes/java/lang/String.java line 528:

> 526:      * <p>
> 527:      * Important: parameter order of this method is deliberately changed 
> in order to
> 528:      * disambiguate it against other similar methods ot this class.

typo?  "ot this".

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

Marked as reviewed by rriggs (Reviewer).

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

Reply via email to