RFR 8009736: Comparator API cleanup

John Rose john.r.rose at oracle.com
Fri Jun 14 14:44:36 PDT 2013

On Jun 14, 2013, at 3:07 AM, Paul Sandoz <paul.sandoz at oracle.com> wrote:

>            this.real = (Comparator<T>) Objects.requireNonNull(real);

Regarding this idiom, I added the following comment to JDK-6919064:

> New JDK 8 code is making frequent use of static methods like Objects.requireNonNull and Objects.equal. If these were open-coded (that is, inlined by hand), the branches and virtual calls (to Object.equals) would be profiled per caller. As global functions, their profiles are polluted, which may cause performance problems. 

> A fix to this bug should demonstrate that Objects.requireNonNull and Objects.equal are as fast as their open-coded equivalents, even in the presence of profile pollution. To pollute the profile of these methods, simply pre-warm the benchmark by a small loop passing a variety of nulls and non-null references to various classes to the arguments of these methods.


— John

More information about the lambda-dev mailing list