JDK-6746334 : SingleByteDecoder can be significantly faster
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio.charsets
  • Affected Version: 6
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-09-09
  • Updated: 2010-08-05
  • Resolved: 2008-11-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u12 b01Fixed
Description
Attached test measures performance of BufferedReader.readline() and it seems that noticiable fraction of 
time is spent in sun.nio.cs.SingleByteDecoder.decodeLoop().

Performance seems to improve significantly if SingleByteDecoder is changed to use char array for 
byteToChar table instead of String. See suggested change in attachment.

In my experiments this change helps to improve performance of ReadlinePerf test by 35-40% - 
time drops from from ~1200ms to 740ms (tested on Windows Vista and XP). 

It also have noticeable impact on reading deployment cache. In my experiments performance 
savings are around 5-7% (reading manifests from index files by CacheEntry).

Comments
EVALUATION Suggested fix is attached.
09-09-2008