United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 4191365 java.io.DataOutputStream.writeUTF could be faster
4191365 : java.io.DataOutputStream.writeUTF could be faster

Details
Type:
Enhancement
Submit Date:
1998-11-19
Status:
Closed
Updated Date:
1999-04-19
Project Name:
JDK
Resolved Date:
1999-04-19
Component:
core-libs
OS:
generic
Sub-Component:
java.io
CPU:
x86
Priority:
P3
Resolution:
Duplicate
Affected Versions:
1.2.0
Fixed Versions:

Related Reports
Duplicate:
Relates:

Sub Tasks

Description
DataOutputStream.writeUTF runs through its argument String twice using 
String.charAt.  Instead, it could use String.getChars to get the chars 
into a local char[] and then walk that (twice).  This would save two 
calls to String.charAt per char, and would avoid the explicit range 
checks that String.charAt does.  One hopes this change would allow a 
good compiler to elide the subscript range checks on the array access, 
etc. generating generally better code.

One might want to avoid the extra char[] if the argument String were 
very long, to avoid running out of memory.

peter.kessler@Eng 1998-11-19

                                    

Comments
EVALUATION

Do it.  -- mr@eng 1998/11/24
                                     
190-06-11 0



Hardware and Software, Engineered to Work Together