On Fri, 12 Feb 2021 09:18:10 GMT, Philippe Marschall <github.com+471021+marsch...@openjdk.org> wrote:
>> Implement three optimiztations for Reader.read(CharBuffer) >> >> * Add a code path for heap buffers in Reader#read to use the backing array >> instead of allocating a new one. >> * Change the code path for direct buffers in Reader#read to limit the >> intermediate allocation to `TRANSFER_BUFFER_SIZE`. >> * Implement `InputStreamReader#read(CharBuffer)` and delegate to >> `StreamDecoder`. >> * Implement `StreamDecoder#read(CharBuffer)` and avoid buffer allocation. > > Philippe Marschall has updated the pull request incrementally with two > additional commits since the last revision: > > - Replace c-style array declarations > - Share work buffer between #skip and #read test/jdk/java/io/InputStreamReader/ReadCharBuffer.java line 34: > 32: import org.testng.annotations.Test; > 33: > 34: import java.io.*; It's generally better not to use a wild card. test/jdk/java/io/InputStreamReader/ReadCharBuffer.java line 73: > 71: } > 72: > 73: buffer.clear(); I think `buffer.rewind()` would be more in keeping with the specification verbiage although there will be no practical effect here. Same comment applies below and in the other test `ReadCharBuffer`. ------------- PR: https://git.openjdk.java.net/jdk/pull/1915