RFR [S] 8077242: (str) Optimize AbstractStringBuilder.append(CharSequence, int, int) for String argument
Ivan Gerasimov
ivan.gerasimov at oracle.com
Sat Jun 27 14:23:29 UTC 2015
Hello!
AbstractStringBuilder, which is base for StringBuilder and StringBuffer
has a method for appending a sub-sequence of a CharSequence.
Internally, it copies one char at a time in a loop, picking them up with
CharSequence.charAt() method.
For the case when the argument is a String, it can be done more
efficiently, by a call to String.getChars().
Since String is a final class, it should be safe to pass 'value' to its
method.
I've also found a few places in JDK where code can be done more
efficient, using this optimization.
Would you please help review this fix?
BUGURL: https://bugs.openjdk.java.net/browse/JDK-8077242
WEBREV: http://cr.openjdk.java.net/~igerasim/8077242/02/webrev/
Sincerely yours,
Ivan
More information about the core-libs-dev
mailing list