Hi Joe!
On 8/9/18 4:20 PM, Joseph D. Darcy wrote:
Hi Ivan,
On which platforms were the benchmark numbers collected?
Ah, yes, should have mentioned that.
macOS 10.13.5 High Sierra, processor 3.1 GHz Intel Core i7
With kind regards,
Ivan
Thanks,
-Joe
On 8/9/2018 4:15 PM, Ivan Gerasimov wrote:
Hello!
Integer.numberOfTrailingZeros() and Long.numberOfTrailingZeros() are
intrinsified by Hotspot, so the Java implementation of these is not
too important.
However, they still can be improved by a tiny bit :)
Could you please help review the fix?
Bug: https://bugs.openjdk.java.net/browse/JDK-8209171
Webrev: http://cr.openjdk.java.net/~igerasim/8209171/00/webrev/
Benchmark for Integer:
http://cr.openjdk.java.net/~igerasim/8209171/00/bench/int/MyBenchmark.java
Benchmark for Long:
http://cr.openjdk.java.net/~igerasim/8209171/00/bench/long/MyBenchmark.java
The resulting code is both smaller and faster. It may also help to
warm up Integer.numberOfLeadingZeros() quicker.
On average, the new Integer.numberOfTrailingZeros() has got +11% to
performance for -client and +1% for -server.
Long.numberOfTrailingZeros() is faster on 17% for -client and +20%
for -server.
--
With kind regards,
Ivan Gerasimov