[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-20 Thread Sjoland
The markup look like this: li class=MenuItem processMenuItem id=MENUID-D a href=processing/x/XbrProcessing/a ul li class=Intro h4If you recieve 20,000 invoices per year, you can save at least $100,000/h4 pLorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-20 Thread John Resig
A lot has changed with regard to the selector engine in 1.3.1 - it this case it looks like these type of selections didn't benefit. One thing that would change that, though, would be caching the selectors that you do run. Right now you run a couple of these over-and-over again. I'd probably

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-20 Thread ricardobeat
It's the calls to $(li).find('li.News a') that make for most of the difference. Without that 1.3.1 is up to 20% faster. Apparently a simple descendant selector in 1.3 is terribly slower i.e. $(el).find('div a') if any as exist (even outside the context). Also '.someclass a' is faster than

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-20 Thread Sjoland
Ok, first of all thank you everyone in the jQuery team, it's a fantastic tool!!! I did all the recommended changes in my methods and these are the results: Sample: $this.getProcessMenuItem = function(li) { var type = processMenuItem; var first = li.find('a:first'); var

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-19 Thread John Resig
Do you have some sample markup? It's kind of hard to determine from just the code. --John On Thu, Feb 19, 2009 at 2:18 PM, Sjoland jo...@sjoland.com wrote: Hi!, When switching between 1.3.1 and 1.2.6 i get a serious drop in speed when collection a JSON object from static HTML content.

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-19 Thread ricardobeat
No idea about the performance drop, but you can improve your main function: // MAIN function getMenuItems(menu) { var menuItems = []; $(menu).find('.MenuItem').each(function(){ var t = $(this), item = false; if (t.hasClass('processMenuItem')) item = getProcessMenuItem (this);

[jQuery] Re: Lower speed with 1.3.1 vs 1.2.6 with simple parsing

2009-02-19 Thread ricardobeat
dang. accidentally pressed send while writing, please ignore my last message. No idea about the performance drop, but you can improve your main function. $(this)[0] is unnecessary, you're creating a new jQuery object and throwing it away. // MAIN function getMenuItems(menu) { var menuItems =