Low hanging fruit to improve performance? readUTF knows the string size ahead of the read and can avoid expandCapacity() by constructing StringBuilder with the expected size. private String readUTFBody(long utflen) throws IOException { - StringBuilder sbuf = new StringBuilder(); --- + StringBuilder sbuf = new StringBuilder((int)utflen); Sample profile output: Stack Trace Sample Count Percentage(%) java.io.ObjectInputStream$BlockDataInputStream.readUTFSpan(StringBuilder, long) 640 22.253 java.util.Arrays.copyOf(char[], int) 146 5.076 java.lang.AbstractStringBuilder.expandCapacity(int) 146 5.076
|