Many times have we been posting the recommendation to speed up your DOM Element lookups by using unique IDs or at least a tag name. So, instead of using $(“.wishlist”) you should use $(“div.wishlist”) which will speed up lookups in older browsers. If you want to lookup a single element then give it a unique ID and change your call to $(“#mywishlist”). This will speed up lookup in older browsers from 100-200ms to about 5-10ms (times vary depending on number of DOM elements on your page). More on this in our blogs 101 on jQuery Selector Performance or 101 on Prototype CSS Selectors.
Case Sensitive ID handling results in interesting performance impact
With the recommendation from above I was surprised to see the following $(“#addtowishlist”) call with a huge execution time difference in IE7, IE8 and FF 6: