I solved this problem for my use case by using an approximate diff.<p>Basically diffing took too long ( I was diffing to remove duplicate frames from a virtualized browser to browser screencast ), so after trying to various options (hashing, diffs, etc) I just went with a simple check of a basically random but fixed set of pixels, which worked really well. I don't have data on the actual false positives/ negatives but for the thing important in my case, perceptual difference and not sending the same frame twice (to save bandwidth and speed) it worked great, and was "constant time".<p>The "code" is here: <a href="https://github.com/c9fe/ViewFinder/blob/84620bd87abb32b2f2c3dc0b79a0be5212fa14ee/zombie-lord/screenShots.js#L9" rel="nofollow">https://github.com/c9fe/ViewFinder/blob/84620bd87abb32b2f2c3...</a><p>And a demo of the project is: <a href="https://demo.browsergap.dosyago.com" rel="nofollow">https://demo.browsergap.dosyago.com</a> (if you check it on Safari mobile you need to plant your clicks about half a finger under where you think they should go, some bug!)<p>I'd like to know some idea of how this posted fast diff works. I checked around the repo and couldn't figure it out, but it seems to be splitting across multiple cores, but still looping over each pixel (but divided by the number of cores). I thought it might be doing something like checking 64-bit blocks somehow, but seems not.