RFR: 8179527: Ineffective use of volatile hurts performance of Charset.atBugLevel() (original) (raw)
Kazunori Ogata OGATAK at jp.ibm.com
Tue Jun 27 05:12:44 UTC 2017
- Previous message: Result: CFV: New JDK 10 Committer: Sharath Ballal
- Next message: RFR: 8179527: Ineffective use of volatile hurts performance of Charset.atBugLevel()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Result: CFV: New JDK 10 Committer: Sharath Ballal
- Next message: RFR: 8179527: Ineffective use of volatile hurts performance of Charset.atBugLevel()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]