thinkpixellab/PxLoader — pull request #7 by Barnabas (2012-02-16 02:27:18+00:00)
Title: Replace Array.indexOf method (and the very slow shim) with a tag object ...

...that does much faster tag comparisons. While testing this library on older, slower machines/browsers with hundreds of images, far and away the resource hog was the hand-rolled indexOf method called by the arraysIntersect method, which was in turn called hundreds of thousands of times on a certain page. IE 8 would pop up the dreaded "uh-oh, looks like a script is running slow, want to abort?" message. That dog just won't hunt. It turns out that using objects with truthy values is much faster and got rid of the problem (proof: http://jsperf.com/lists-indexof-vs-in-operator/3). Of course the array is still retained; after all tag order is important.