Avoid allocations in some compare() methods

Aleksey Shipilev shade at redhat.com
Sun Apr 23 20:25:39 UTC 2017


Hey,

On 04/23/2017 08:30 PM, Christoph Dreis wrote:
> I've just noticed that some compareTo() or compare() implementations with
> primitives use Long.valueOf(x).compareTo(Long.valueOf(y)) instead of simply
> calling Long.compare(x, y);

Oh yes, we avoided this before, because JMH was JDK 6 compatible. Now we
required JDK 7 as minimum, so we can finally use these convenience methods. We
purged most JDK 6 anachronisms with IDEA migration aids, but this one appears
missing from their analysis:
  https://youtrack.jetbrains.com/issue/IDEA-171854

Pushed the change as:
  https://bugs.openjdk.java.net/browse/CODETOOLS-7901955

Thanks,
-Aleksey



More information about the jmh-dev mailing list