RFR: 8145680: Remove unnecessary explicit initialization of volatile variables in java.base
Andrew Haley
aph at redhat.com
Mon Dec 21 09:46:37 UTC 2015
On 20/12/15 20:02, Jason Mehrens wrote:
> For the cases where boolean was being assigned to 'true' (ASSCI and
> FileLockImpl) does it hurt performance since the accessor methods
> will now include a branch at the bytecode level?
That depends on the caller. A trivial accessor method will usually be
inlined: if the caller uses ! foo.isOpen(), say, the two uses of !
will cancel.
> See: "Speed-kings of inverting booleans" at
> http://www.javaspecialists.eu/archive/Issue042.html
That's from 2002, and not valid any more. Maybe not valid even back
then.
Andrew.
More information about the core-libs-dev
mailing list