Currently not logged in. main | wiki | tasks | examples | forums | privacy | login

fiinfo is S-L-O-W ( trfried | 2013 march 29., fri - 15:47 )

fiinfo is quite slow. In the process of trying to understand why (I am, in particular, using "fiinfo -d sky"), I've found a trivial but significant speedup, at least for my purposes.
I'm examining images from an SBIG STL-11000 camera (nearly 11 megapixels of 16-bit data). The median function performs a qsort() of the pixel data, using median_compare(). median_compare() always returns plus or minus 1, never returning 0 (equality). This would appear to be a reasonable choice, given that it expects to be comparing double-precision data, but in fact, the data are derived from integers, and equality is a likely outcome. But never returning equality fools qsort() into doing more work than is necessary.
Adding an equality test to median_compare() speeds up the final qsort() that computes the value of rsky in fits_stat_sky_biquad() significantly, for my data. In fact, it completes in about a half-second instead of 6 seconds. The other qsort() calls are sped up slightly, but noticeably. The overall execution of "fiinfo -d sky" is reduced from nearly 20 seconds to just over 10 seconds.
This speedup is really not enough for my needs, but it is at least closer. SExtractor calculates essentially the same sky background numbers, but does so in under a half-second. Unfortunately, SExtractor goes on to scan the image for star locations, which are irrelevant to my purpose, but there's no way to tell SExtractor to stop.


link