Greetings Dylan, I'm noticing something about performance when loading regions of stacks that puzzles me, and I'd appreciate your feedback when your time allows. I've got a large (800 x 1200 x 500) TIFFstack object and want to load _n_ small regions of interest into memory - these ROIs encompass just a few pixels in XY but the entire stack in Z. For purposes of demonstration I used _n=3_ but in reality it could be anywhere from 10 to a few hundred. I ran the following simple timing tests: ``` % Load just the desired regions tic spotStack1 = stackObj(1:10,1:10,:); spotStack2 = stackObj(21:30,21:30,:); spotStack3 = stackObj(31:40,31:40,:); toc Elapsed time is 23.025320 seconds. tic % Load the whole stack first memStack = stackObj(:,:,:); spotStack1 = memStack(1:10,1:10,:); spotStack2 = memStack(21:30,21:30,:); spotStack3 = memStack(31:40,31:40,:); toc Elapsed time is 14.418438 seconds. ``` Loading just the desired regions obviously uses (much) less memory, but as you can see, loading the whole stack (and then slicing it) is actually faster. The difference is not huge when _n=3_ but gets really significant when _n_ is larger. In further tests I observed that `memStack = stackObj(:,:,:); ` takes exactly the same amount of time as `spotStack = stackObj(1:10,1:10,:); ` This last observation really puzzles me. `spotStack` is 10 kb in size; `memStack` is 960 MB. Naively I'd have thought that reading a much smaller amount of data from disk would be faster, but it's not. Unless TIFFStack is actually reading the whole TIFF file from disk regardless, but just not copying the whole thing into memory? Do you have any ideas about why this is happening and whether performance when loading small regions could be improved? Thanks for any input.
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by dickinson-lab and has received 4 comments.