Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
None
-
b14
-
arm, ppc
Description
java.nio.charset.Charset.atBugLevel() uses a volatile variable to cache the value of a system property "sun.nio.cs.bugLevel". The atBugLevel() method is used when a byte array is converted to a string, such as "new String(byteArray, offset, length, charset)".
This variable need not to be volatile because the system property is a runtime constant and updating the cache variable multiple times produces the same result.
Reading from a volatile variable in some platforms, such as PPC and ARM, causes extra overhead to synchronize memory accesses with other threads and hurts performance, while there is no overhead in x86 platforms.
We verified that removing this "volatile" qualifier improved performance by 26% in a POWER8 machine using a micro benchmark that repeatedly creates String object from a byte array.
This variable need not to be volatile because the system property is a runtime constant and updating the cache variable multiple times produces the same result.
Reading from a volatile variable in some platforms, such as PPC and ARM, causes extra overhead to synchronize memory accesses with other threads and hurts performance, while there is no overhead in x86 platforms.
We verified that removing this "volatile" qualifier improved performance by 26% in a POWER8 machine using a micro benchmark that repeatedly creates String object from a byte array.
Attachments
Issue Links
- csr for
-
JDK-8183116 Drop property sun.nio.cs.bugLevel
-
- Closed
-
- relates to
-
JDK-8184330 Remove sun.nio.ch.Util.atBugLevel() either completely or at least get rid of volatile field bugLevel
-
- Resolved
-