Mike, the requirement here isn't just to show or hide all 3000 entries in one fell swoop. Sid needs to be able to show and hide individual entries depending on a filter. So there's no avoiding looping through all the entries, whether in JavaScript or on the server.
Sid, assuming you want to do this on the client, I think you're on the right track with building an HTML string and using innerHTML. You should be able to get acceptable (<1s) performance with 3000 items even in IE7/8. (But is the number of items going to be greater in the future?) If you'd like to post the code for your inner loop that generates the HTML, I'll bet we can find a trick or two to optimize it. Also, take a look at some related code I posted here<http://groups.google.com/group/jquery-en/browse_thread/thread/051996d22119293c/121203c4216c34ee?show_docid=121203c4216c34ee>for some optimization tips. One thing I would possibly do in your case that's different from that code I posted: Since you're inserting a clearing div after each two entries, you may want to unroll the inner loop by 2X, so that each time through the loop you generate *two* of your entries plus the clearing div. Then take care of the possible extra entry outside the loop. I would try it both ways and benchmark it particularly in IE since that's the slowest browser for JavaScript. Raymond and William mentioned using Ajax and doing the filtering on your server. That's certainly worth considering too. -Mike On Mon, Sep 28, 2009 at 11:09 AM, Mike McNally <emmecin...@gmail.com> wrote: > > > @Mike M. > > You're still looping through 3000 jQuery objects and invoking the > > setClass() method. I haven't tried it but I suspected it will take > > roughly the same time as the show() method. It does seem logical that > > the actual showing of the div will be faster if the browser does it > > natively. The question which part is the bottleneck - looping through > > 3000 jQuery objects or actually show()ing them one by one? If I can > > experiment and find out, I will - and I'll post the results. > > No, you're not. You completely misunderstood. You're calling > "setClass" on the single container, not each contained div. > > > > > -- > Turtle, turtle, on the ground, > Pink and shiny, turn around. >