Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-83

GzipCompressorOutputStream should forward write(byte[] buf) and write(byte[] buf, int off, int len) to underlying stream

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1
    • None
    • None
    • Linux

    Description

      Current version of GzipCompressorOutputStream decorates only write(int b) method for underlying java.zip.util.GZipOutputStream.

      In common scenario of:

      OutputStream os = ...;
      GzipCompressorOutputStream gcos = new GzipCompressorOutputStream(os);
      [do extensive write(byte[] buf]

      this results in very slow unbuffered write. This is particularly evident if the code changes to:

      OutputStream os = ...;
      GZIPOutputStream gos = new GZIPOutputStream(os);
      [do extensive write(byte[] buf]

      ...which is blazingly faster.

      In my environment, packing 100 Mb stream with Commons wrapper takes about 120 seconds, while using java.util.zip directly takes less than 1 second.
      This performance hit is way too bad for simple wrapper.

      Attachments

        Activity

          People

            Unassigned Unassigned
            aleksey.shipilev Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 1h
                1h
                Remaining:
                Remaining Estimate - 1h
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified