RFR: 8316587: Use ArraysSupport.vectorizedHashCode in Utf8EntryImpl [v2]

Claes Redestad redestad at openjdk.org
Thu Sep 21 12:21:46 UTC 2023


On Thu, 21 Sep 2023 02:38:08 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Like #12077, this uses JDK's internal utilities to speed up ASCII reading in Class files, where most identifiers, from conventions to attribute names, are ASCII. See the JBS issue for more in-depth explanations.
>> 
>> Before: (Master)
>> 
>> Benchmark                         Mode  Cnt    Score   Error  Units
>> ReadMetadata.jdkReadMemberNames  thrpt    4  167.623 ± 8.522  ops/s
>> 
>> 
>> After: (This patch, first revision)
>> 
>> Benchmark                         Mode  Cnt    Score   Error  Units
>> ReadMetadata.jdkReadMemberNames  thrpt    4  175.908 ± 4.766  ops/s
>
> Chen Liang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix logical bug with char array filling

I can verify the improvement locally in your added micro:

Name                            Cnt         Base    Error          Test    Error   Unit   Diff%
ReadMetadata.jdkReadMemberNames   4      108.234 ±  1.089       114.953 ±  0.709  ops/s    6.2% (p = 0.000*)

I don't have domain expertise w.r.t the classfile API to value how much this will benefit typical use-cases, but it seem like a straightforward enough improvement to me. (At least the `vectorizedHashCode` has the nice property that it's always faster than a naive `31 * hash + v` loop, even when inputs are too small to actually benefit from SIMD instructions).

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

PR Comment: https://git.openjdk.org/jdk/pull/15837#issuecomment-1729454730


More information about the core-libs-dev mailing list