For CPU generation we get better performance the earlier in the library images we find the best fit.
We calculate the sum of the differences of pixels, and we know the current best, so if the current sum exceeds the best then we don't need to keep comparing.
In the case that the first library image is the best fit this would then mean we don't fully calculate the difference for any of the following library images.
We should be able to sort the library images to exploit this property (atleast to a certain degree). Sorting options:
For CPU generation we get better performance the earlier in the library images we find the best fit. We calculate the sum of the differences of pixels, and we know the current best, so if the current sum exceeds the best then we don't need to keep comparing. In the case that the first library image is the best fit this would then mean we don't fully calculate the difference for any of the following library images.
We should be able to sort the library images to exploit this property (atleast to a certain degree). Sorting options: