PyramidOMETiffWriter close()
duration scales as a (number of planes)^2
#4204
Milestone
close()
duration scales as a (number of planes)^2
#4204
Hello,
Original post: https://forum.image.sc/t/pyramidometiffwriter-really-bad-performance-when-closing-the-writer/95294
There is a (very big) performance issue when saving an OME TIFF file with
PyramidOMETiffWriter
as theclose()
method duration scales as the number of planes squared.I've tested to save a 512x512 pixel file on my computer and increase the number of timepoints by powers of 2 (nT). I've measured the time required to save the file and split the required time between what happens before calling close, and the close duration:
The data writing time scales linearly with the number of timepoints, which is what we expect. However the close time is multiplied by 4 each time the number of timepoints is multiplied by 2.
As a result, 'close' takes 90% of the total export time when there are 1024 timepoints.
I've narrowed the issue to the call of
TiffParser#getIFDOffsets
for all planes,getIFDOffsets
walking the whole file from the start. This scales very badly.PyramidOMETiffWriter#close
loops through all planes:bioformats/components/formats-bsd/src/loci/formats/out/PyramidOMETiffWriter.java
Line 125 in 7ca9980
TiffSaver#overwriteIFDValue
bioformats/components/formats-bsd/src/loci/formats/out/PyramidOMETiffWriter.java
Line 145 in 7ca9980
TiffParser#getIFDOffsets
bioformats/components/formats-bsd/src/loci/formats/tiff/TiffSaver.java
Line 804 in 7ca9980
TiffParser#getIFDOffsets
walks through the whole filebioformats/components/formats-bsd/src/loci/formats/tiff/TiffParser.java
Lines 362 to 363 in 7ca9980
Is there a way to fix this ?
This issue could be related to these other issues:
#3983
#3480
The text was updated successfully, but these errors were encountered: