JFR ChunkInputStream uses single byte read()
David Schlosnagle
schlosna at gmail.com
Tue Aug 13 22:45:00 UTC 2024
Hi JFR dev,
I would like to contribute an improvement to reading JFR recordings via
`InputStream` by implementing `InputStream#read(byte[], int, int)` in
`ChunkInputStream` to support bulk reads and avoid many expensive single
byte `read()`.
PR: https://github.com/openjdk/jdk/pull/20534
Testing: `test/jdk/jdk/jfr/api/consumer/TestChunkInputStreamBulkRead.java`
While looking through some JFRs recently, I noticed some significant time
spent in `java.io.BufferedInputStream#getBufIfOpen()` that traced back to
transferring (via `InputStream#transferTo(OutputStream)` JFR profile
recording being read via `InputStream` returned by
`jdk.jfr.Recording#getStream(Instant , Instant)`. What caught my eye were
calls to single byte `jdk.jfr.internal.ChunkInputStream#read()` rather than
`read(byte[], int, int)` as seen in the stacktrace from JFR.
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-jfr-dev/attachments/20240813/81103ff7/attachment.htm>
More information about the hotspot-jfr-dev
mailing list