RFR: 8179527: Ineffective use of volatile hurts performance of Charset.atBugLevel()
Seán Coffey
sean.coffey at oracle.com
Tue Jun 27 08:40:06 UTC 2017
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 ppc-aix-port-dev
mailing list