On 05.01.21 01:53, Brian Burkhalter wrote:
On Thu, 31 Dec 2020 10:11:58 GMT, Philippe Marschall <github.com+471021+marsch...@openjdk.org> wrote: ... How does the performance of `InputStreamReader.read(CharBuffer)` compare for the case where only the change to `Reader` is made versus if all your proposed changes are applied?
I left the delegating one in InputStreamReader in but removed all changes in StreamDecoder. Performance looks pretty good: on-heap CharBuffer - Throughput is a slightly lower than with the changes but close and still better than before. - Allocation rate is drastically reduced and comparable to the results with the changes except for small buffer sizes (128 bytes). off-heap CharBuffer - Relative throughput depends on the buffer size. For small buffers (128 bytes) throughput is a bit lower than master but increases with buffer size. For 1 KB buffers it is about even, for 1 MB buffers it is better. Throughput is a lot better than with the StreamDecoder changes without intermediate allocation, there we lose about one half to two thirds of throughput. - Allocation rate stays high (1.5 - 3 GB/s) and only drops with large buffer sizes (1 MB) to 20 - 30 MB/s. The StreamDecoder changes cause the allocation rate to drop to almost zero. To be honest backing out of the StreamDecoder changes looks like a good comprise to me to reduce the risk while still improving throughput and reducing allocation rate, especially in the on-heap path. Looking a bit further I wonder if CharArrayReader and StringReader should implement #read(CharBuffer) as well and call CharBuffer#put directly. And maybe even #transferTo(Writer). Cheers Philippe