Closed aphalo closed 10 months ago
Done. It was really a major bottleneck. Using rle()
did the trick together with aborting early in the absence of any NAs. With HDR conversion from RAW to IRRAD the total time went from 190 ms to 20 ms, with no HDR, the total time decreased by 2/3.
Profiling shows that a lot of time is spent in this function. It has nested for loops, one of them walking pixel by pixel the whole spectrum.
I think using
rle()
instead of the inner loop one could speed up this function a lot.Without HDR it takes some 72 ms per spectrum, with HDR 190 ms.