performance surprise with Object.hashCode()

Vitaly Davidovich vitalyd at
Mon May 13 13:27:49 PDT 2013

Why would o_i without intrinsic need a typecheck? Every object has
hashCode, it should be just a vcall.  The intrinsic win is (based on
discussion here) only when the receiver does not implement hashCode; for
the case when it does, this looks like a net loss because all the
checks/guards fail and just waste time before calling through virtually

Sent from my phone
On May 13, 2013 4:04 PM, "Aleksey Shipilev" <aleksey.shipilev at>

> On 05/14/2013 12:00 AM, Vitaly Davidovich wrote:
> > I'm comparing i_i vs o_i difference when intrinsic is enabled/disabled.
> > Based on your results, when intrinsic is disabled the o_i case is
> > marginally slower than i_i, whereas it's noticeably slower otherwise.
> Ah yes. That's because i_i is perfectly devirtualized without any
> typechecks (re-reading my original note, there is mention of typecheck,
> disregard that, see the hot loop in assembly, it is perfect). o_i
> without intrinsic has the typecheck nevertheless, and we are wasting
> some of the time there. o_i with intrinsic seems to lose the
> devirtualization completely.
> -Aleksey.
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the hotspot-compiler-dev mailing list