[intrinsics] performance improvements for the intrinsified version of Objects::hash

Aleksey Shipilev shade at redhat.com
Thu Mar 7 21:40:39 UTC 2019


On 3/7/19 10:20 PM, Vicente Romero wrote:
>> *) I guess what you want to check for performance when arguments read from instance fields -- that
>> would be the target test case that simulates Object.hashCode(), no?
> 
> reading instance fields or local variables shouldn't make a big difference

It would for @Benchmarks, because reading from @State field would make sure neither javac nor JIT
compiler knows the value during the compilation. See e.g.:

https://hg.openjdk.java.net/code-tools/jmh/file/5984e353dca7/jmh-samples/src/main/java/org/openjdk/jmh/samples/JMHSample_10_ConstantFold.java

Arguably, reading from fields is what would happen "in real world", when Object::hashcode is called
on object with unknown identity, object fields have to be read before calling into Object::hash,
etc. Measuring folding through the constants is good, but it might not be the target scenario here.

-Aleksey



More information about the amber-dev mailing list