RFR: 4926314: Optimize Reader.read(CharBuffer)

Philippe Marschall github.com+471021+marschall at openjdk.java.net
Thu Dec 31 10:15:12 UTC 2020


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.

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

Commit messages:
 - 4926314: Optimize Reader.read(CharBuffer)

Changes: https://git.openjdk.java.net/jdk/pull/1915/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1915&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-4926314
  Stats: 101 lines in 3 files changed: 68 ins; 8 del; 25 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