Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-786

Unsynchronized BufferedInputStream

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Implemented
    • None
    • 2.12.0
    • Streams/Writers
    • None
    • JRE 19, linux

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            btellier Benoit Tellier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: