回复:Eliminate unnecessary buffering and encoding conversion in BufferedWriter

2025-06-30 Thread wenshao
If we use StringBuilder as the buffer of BufferedWriter, we need to make StreamEncoder and all CharsetEncoders support write(StringBuilder) to achieve better performance. There are many CharsetEncoders here, and this change is too much. And there is a scenario where performance will be degraded.

回复:Eliminate unnecessary buffering and encoding conversion in BufferedWriter

2025-06-30 Thread wenshao
The BufferedWriterBench I added in PR 26022 can be configured to see the performance of different encodings. We can run the following command to see the performance of different encodings on different content. The test numbers show that the performance of BufferedWriter::write(String) is improve

回复:Eliminate unnecessary buffering and encoding conversion in BufferedWriter

2025-06-29 Thread wenshao
Both Writer and CharsetEncoder are designed for char[]. Converting BufferedWriter to use byte[] value + byte coder like StringBuilder will also require redundant encoding conversion when using LATIN1 String, and the performance will not be good. --