What is the best algorithm for image comparison in terms of speed?
I want to avoid changes due to light effects


A similarity measure based on binary descriptor can deal with this issue since it designed for multimodal images.

Also, you can try correlation coefficient since it cloud be used for real-time applications. for more information visit this page. Hence this algorithm in Matlab as a function called corr2 to find the degree of similarity between 2 images.