Unexpected performance of operator % vs &

Andrew Haley aph-open at littlepinkcloud.com
Sun Jul 23 16:46:56 UTC 2023


On 7/22/23 23:32, Scott Palmer wrote:
> On Linux the results are the opposite of what I would expect.
> Interestingly JDK 20.0.1 on macOS had no significant difference between the
> two methods, but on Linux it did.

Mmm, but look at those numbers. That's ~ two clock cycles per iteration.
I think we can safely say that a modulo instruction is not being used.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the hotspot-dev mailing list