josefrichter/jquery-grayscale — pull request #2 by amclin (2012-10-24 16:56:07+00:00)
Title: Improve performance of grayscale calculation steps

The grayscale calculation involving nested loops that check properties of the image on every loop are inefficient. On top of that, the extra calculation to determine the pixel position based on the interation of the nested loops adds more overhead

This can be collapsed into a single iterative loop, without an inner calculation. Considering this loop runs literally thousands of times on even a small image, simplification makes for a significant performance improvement.