RFR: 8179527: Ineffective use of volatile hurts performance of Charset.atBugLevel() (original) (raw)

Kazunori Ogata OGATAK at jp.ibm.com
Tue Jun 27 08:48:54 UTC 2017


Hi Sean,

Thank you for your suggestion.

Langer, Christoph has gave me the same comment and redirected the RFR to core-libs-dev and nio-dev. Sorry for not telling it here jdk10-dev earlier.

Regards, Ogata

Seán Coffey <sean.coffey at oracle.com> wrote on 2017/06/27 17:40:06:

From: Seán Coffey <sean.coffey at oracle.com> To: Kazunori Ogata <OGATAK at jp.ibm.com>, ppc-aix-port-dev at openjdk.java.net, nio-dev at openjdk.java.net Cc: jdk10-dev at openjdk.java.net Date: 2017/06/27 17:40 Subject: Re: RFR: 8179527: Ineffective use of volatile hurts performance

of Charset.atBugLevel()

This should be reviewed on nio-dev. Please drop jdk10-dev on reply. The atBugLevel(String) method seems to be more for legacy use from JDK 1.4/1.5 family. Maybe it's time to drop its use? We'd need to check if the VM.isBooted() call is still necessary. regards, Sean. On 27/06/2017 06:12, Kazunori Ogata wrote: > Hi all, please review a change for JDK-8182743. > > Bug report: https://bugs.openjdk.java.net/browse/JDK-8182743 > Webrev: http://cr.openjdk.java.net/~horii/8179527/webrev.00/ > > This change removes a "volatile" qualifier of a static variable used by > Charset.atBugLevel() because it does not improve thread-safety of the code > and it hurts performance on PPC (and should be the same in ARM, too). > Removing the "volatile" improved performance by 26% in a POWER8 machine > using following micro benchmark: > > ------ > import java.io.*; > import java.nio.ByteBuffer; > import java.nio.charset.Charset; > import java.util.ArrayList; > > class ConvertTest { > static String str; > > public static void main(String[] args) { > byte buf[] = { 0x41 }; > Charset fromCharset = Charset.forName("iso-8859-1"); > > long start = System.currentTimeMillis(); > > for(long i = 0; i < 100000000; i++)_ _> str = new String(buf, 0, 1, fromCharset); > > long end = System.currentTimeMillis(); > > System.out.println("Elapsed: "+(end-start)+" ms"); > } > } > ------ > > > Regards, > Ogata >



More information about the jdk10-dev mailing list