On Tue, 12 Jul 2022 15:57:12 GMT, Roger Riggs <rri...@openjdk.org> wrote:

>> Benchmark results after:
>> 
>> Benchmark                                                  Mode  Cnt  Score  
>>  Error  Units
>> StringConstructor.newStringFromArray                       avgt   50  4,354 
>> ± 0,195  ns/op
>> StringConstructor.newStringFromArrayWithCharset            avgt   50  4,035 
>> ± 0,088  ns/op
>> StringConstructor.newStringFromArrayWithCharsetName        avgt   50  8,166 
>> ± 0,062  ns/op
>> StringConstructor.newStringFromRangedArray                 avgt   50  4,132 
>> ± 0,054  ns/op
>> StringConstructor.newStringFromRangedArrayWithCharset      avgt   50  4,416 
>> ± 0,206  ns/op
>> StringConstructor.newStringFromRangedArrayWithCharsetName  avgt   50  7,421 
>> ± 0,041  ns/op
>
> Matching the existing Void argument looks better.
> The new private method should have a comment saying that it does not do any 
> precondition checks on the arguments.
> 
> (Reordering the arguments is an alternative to adding an argument, for 
> example, (Charset, byte[], int, int).
> But it is less readable and can raise questions due to the different order of 
> arguments.)

Updated PR. With newer version I get these results:

Benchmark                                                  Mode  Cnt  Score   
Error  Units
StringConstructor.newStringFromArray                       avgt   50  4,831 ± 
0,205  ns/op
StringConstructor.newStringFromArrayWithCharset            avgt   50  3,940 ± 
0,008  ns/op
StringConstructor.newStringFromArrayWithCharsetName        avgt   50  7,662 ± 
0,112  ns/op
StringConstructor.newStringFromRangedArray                 avgt   50  4,175 ± 
0,065  ns/op
StringConstructor.newStringFromRangedArrayWithCharset      avgt   50  3,970 ± 
0,037  ns/op
StringConstructor.newStringFromRangedArrayWithCharsetName  avgt   50  7,480 ± 
0,014  ns/op

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

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

Reply via email to