RFR: 8361640: JFR: RandomAccessFile::readLine emits events for each character

Alan Bateman alanb at openjdk.org
Tue Jul 15 16:12:40 UTC 2025


On Wed, 9 Jul 2025 05:45:01 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:

> Could I have a review of the change that prevents RandomAccessFile::readLine from emitting an event per character? This leads to unnecessary overhead, both with or without JFR enabled.
> 
> Testing: tier1 + tier2 +  jdk/jdk/jfr
> 
> Thanks
> Erik

src/java.base/share/classes/java/io/RandomAccessFile.java line 1039:

> 1037:     }
> 1038: 
> 1039:     private String traceImplReadLine() throws IOException {

I think it would be cleaner to have the FileReadEvent usage in readLine. That would reduce this to readLine + implReadLine, no traceImplReadLine.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26210#discussion_r2207938638


More information about the core-libs-dev mailing list