Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-95

Some tiff processing takes very long

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-alpha1
    • 1.0-alpha1
    • Format: TIFF
    • None

    Description

      org.apache.commons.imaging.formats.tiff.TiffReader.getTiffRawImageData(ByteSource, TiffDirectory) 226635 1
      org.apache.commons.imaging.common.bytesource.ByteSourceInputStream.getBlock(int, int) 226588 5616
      org.apache.commons.imaging.common.BinaryFileFunctions.skipBytes(InputStream, int) 226526 5616
      org.apache.commons.imaging.common.BinaryFileFunctions.skipBytes(InputStream, int, String) 226526 5616
      org.apache.commons.imaging.common.bytesource.ByteSourceInputStream$CacheReadingInputStream.read(byte[], int, int) 226526 188656860
      org.apache.commons.imaging.common.bytesource.ByteSourceInputStream$CacheBlock.getNext() 64581 188651244
      skip bytes is being called repeatedly again and again, last column is invocation count in one call tree. Second column is total number of time taken by that method in that call tree..

      and skip method is not overridden org.apache.commons.imaging.common.bytesource.ByteSourceInputStream.CacheReadingInputStream and default implementation of InputStream tries to use read method (which is overridden in CacheReadingInputStream) to skip.

      In case of a tiff, which has large number of strips, skip is repeatedly called and use of read is inefficient as it tried to do a System.arraycopy. array copy is not needed in case of skip operation, as the bytes were already read in block/cached, we can simply jump the pointer (block by block)

      Attachments

        1. tiff_perf_fix2.patch
          2 kB
          Amit Gupta

        Activity

          People

            Unassigned Unassigned
            amitgupt Amit Gupta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: