The operation performed by `cdist' involves working on the image column by column. On a virtual memory machine, this is to commit the cardinal sin of accessing an array in the wrong order-against the grain of the virtual memory system. When large images are processed, the result will be excessive page faulting by the process, together with a dramatic increase in the time taken (both CPU time and elapsed time go up), and an even more dramatic increase in the anger levels of the other users of the machine, since the excessive paging will begin to saturate the disk I/O system. This condition is described as `thrashing'.
To reduce this faulting, it is possible to rotate the image before it is processed and rotate it back afterwards. `cdist' has a hidden parameter `rotate' which makes it do this automatically. The final results obtained are the same whether or not `rotate' is specified, but the efficiency of the operation can be quite different. Specifying `rotate' adds the overheads of the two rotations, but makes the correction work properly with the virtual memory system. For small images, where the correction algorithm probably does not induce thrashing anyway, use of pre and post rotation will be inefficient since it adds the overheads of the two rotations. However, these overheads are small for small images, and it is probably acceptable to always specify `rotate'. This is why `rotate' is a hidden parameter, true by default.
Just what constitutes a `small' or a `large' image-i.e. the size of image at which one starts to gain by specifying `rotate'-is hard to say. The best guide is trial and error. As it usually is.
FIGARO A general data reduction system