Commons IO
  1. Commons IO
  2. IO-296

ReaderInputStream optimization: more efficient reading of small chunks of data

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None

      Description

      ReaderInputStream in its current form does not efficiently handle reading of small data chunks. #read(byte[] b, int off, int len) methods compacts encoderOut on every read operation, which is not very efficient if the chunks of data being read are smallish. This especially affects the #read() method, which currently reads one byte of data into a temporary byte array. Not to mention that allocation of a temporary byte array on each #read() method invocation leads to generation of unnecessary intermediate garbage on the heap.

        Activity

        Hide
        Oleg Kalnichevski added a comment -

        The proposed patch should improve efficiency and (potentially) performance of ReaderInputStream reading small chunks of data.

        Please review.

        Oleg

        Show
        Oleg Kalnichevski added a comment - The proposed patch should improve efficiency and (potentially) performance of ReaderInputStream reading small chunks of data. Please review. Oleg
        Hide
        Gary Gregory added a comment -

        Version 2.2 has been released and addresses this issue.

        Show
        Gary Gregory added a comment - Version 2.2 has been released and addresses this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Oleg Kalnichevski
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development