Benoit Tellier created IO-786:
---------------------------------
Summary: Unsynchronized BufferedInputStream
Key: IO-786
URL: https://issues.apache.org/jira/browse/IO-786
Project: Commons IO
Issue Type: Improvement
Components: Streams/Writers
Environment: JRE 19, linux
Reporter: Benoit Tellier
As part of development of Apache James I had the unpleasant surprise to notice
that, on modern JVMs, the cost of synchronization skyrocketed (JRE 19).
In one part of the code, we do need to find the exact location of email header
end, and for this needs to read an InputStream byte by byte. We of course
buffer the inputStream in order to limit potential blocking calls. Profiling
showed 73% of the reading time is spent synchronizing on the
BufferedInputStream. Thus I am keen on having an
UnsynchronizedBufferedInputStream & friends at hand. See attached screenshot.
=> This is reported upstream see https://bugs.openjdk.org/browse/JDK-4097272 .
This was disregarded in lower Java version but I hope it "could" be
reconsidered.
=> While I can duplicate the class in Apache James source code and remove
synchronised keywords, this sounds a generic enough to fit in commons-io.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)