You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2023/02/01 14:35:00 UTC

[jira] [Resolved] (IO-786) Unsynchronized BufferedInputStream

     [ https://issues.apache.org/jira/browse/IO-786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved IO-786.
--------------------------------
    Fix Version/s: 2.12.0
       Resolution: Implemented

> 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
>            Priority: Major
>             Fix For: 2.12.0
>
>         Attachments: Screenshot from 2023-01-30 09-06-03.png
>
>
> 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)