RFR: 4926314: Optimize Reader.read(CharBuffer) [v9]

Philippe Marschall github.com+471021+marschall at openjdk.java.net
Sat Mar 13 14:28:25 UTC 2021


> 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 with a new target base due to a merge or a rebase. The pull request now contains 15 commits:

 - Merge master
 - Fix bug in CharArrayReader and add unit test
 - Clean up unit tests
 - Revert off-heap code path
 - Replace c-style array declarations
 - Share work buffer between #skip and #read
 - Update copyright year
 - Implement review comment
 - Revert StreamDecoder changes
 - Implement CharArrayReader#read(CharBuffer)
 - ... and 5 more: https://git.openjdk.java.net/jdk/compare/d339320e...c4c859e0

-------------

Changes: https://git.openjdk.java.net/jdk/pull/1915/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1915&range=08
  Stats: 371 lines in 6 files changed: 361 ins; 0 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1915.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1915/head:pull/1915

PR: https://git.openjdk.java.net/jdk/pull/1915


More information about the nio-dev mailing list