Hi,

> Are
> there any tricks to help this out?  For example is it
> better to use xpath or css type searches for better
> performance?

You may speed your code up ba choosing the selector. Usually just searching 
for the id ahould be the fastest: $('#myid'). Number Two is searching for the 
tag type: $('li'). Searching for classes is rather slow: $('.myclass').

If your page contains many elements, then using a context might speed up the 
search for classes: $('.myclass',$('#commonAncestor')[0]).

> I've learned the trick about using .end() correctly to
> reset searches without starting from scratch, and that
> helped a bit but it's not quite enough.

You can try and cache results, speedup loops in callbacks, etc. There are many 
possible ways to improve JS-code, but without any code I guess noone can 
really help.

I do think that there are some spots in jQuery where the performance could be 
improved. We have that discussion here once in a while. It basically comes 
out to be a tradeof between readability and speed.

Christof

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to