Chen,

I developed this code after you triggered me to do so one year ago, and would like to contribute it now. As Alan told me back then, I must not file a Pull Request without prior discussion on the core-libs mailing list. As nobody responded so far, I kindly ask for your personal agreement on the mailing list to proceed with a PR, so we can progress towards your proposed usage of CharSequence::getChars() within OpenJDK itself. A short public confirmation that you like to see such a PR would be enough IMHO.

Thank you!

-Markus


Am 21.02.2026 um 17:32 schrieb Markus KARG:
Core-Lib Devs,

as proposed in https://bugs.openjdk.org/browse/JDK-8377939 I would like to improve efficiency of StreamEncoder::append(CharSequence) (and in turn OutputStreamWriter::append(CharSequence)) for non-String and non-CharBuffer values, which seems to be safe and simple:

* No API or behavior is changed.
* StreamEncoder is final and is only used internally of OpenJDK, and is not leaked. * AFAIK the proposed change has no side effects other than being potentially more efficient. * Only few classes make actual use of StreamEncoder; OutputStreamWriter is probably the most popular one, and immediately provides potential benefit to I/O-bound applications dealing with StringBuilder-crafted output.

I have meanwhile coded the change (see diff at https://github.com/openjdk/jdk/compare/master...mkarg:jdk:StreamEncoder-uses-CharsSequence-getChars) and tested it successfully using OpenJDK Github Actions (see result at https://github.com/mkarg/jdk/actions/runs/22259626078).

Are you fine with me opening a Pull Request on Github?

Thanks!

-Markus

Reply via email to