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.
>
> 1.2.6
> FF: 325ms
> Safari: 75ms
> IE7: 450ms
>
> 1.3.1
> FF: 1205ms
> Safari: 415ms
> IE7: 1550 ms
>
> The javascript collects data into a JSON object with a few methods
> like this:
>
> // MAIN
> function getMenuItems(menu) {
>        var menuItems = [];
>        $(menu).find('.MenuItem').each(function(){
>                var item = false;
>                if ($(this).hasClass('processMenuItem')) item = 
> getProcessMenuItem($
> (this)[0]);
>                if ($(this).hasClass('softwareMenuItem')) item = 
> getSoftwareMenuItem
> ($(this)[0]);
>                if ($(this).hasClass('listMenuItem')) item = 
> getListMenuItem($(this)
> [0]);
>                if ($(this).hasClass('aboutMenuItem')) item = 
> getAboutMenuItem($
> (this)[0]);
>                menuItems.push(item);
>        });
>        return menuItems;
> };
>
> // COLLECTOR
> function getProcessMenuItem(li) {
>        var type = "processMenuItem";
>        var item = {
>                "id" : $(li).attr('id'),
>                "type" : type,
>                "title" : $(li).find('a:first').text(),
>                "URI": $(li).find('a:first').attr('href'),
>                "preamble" : $(li).find('li.Intro h4').text(),
>                "body" : $(li).find('li.Intro p').text(),
>                "news" : {
>                        "title" : $(li).find('li.News a').text(),
>                        "URI" : $(li).find('li.News a').attr('href'),
>                        "summary" : $(li).find('li.News a').attr('title')
>                },
>                "splash" : {
>                        "title" : $(li).find('li.Splash a').text(),
>                        "URI" : $(li).find('li.Splash a').attr('href'),
>                        "summary" : $(li).find('li.Splash a').attr('title'),
>                        "media" : $(li).find('li.Splash img').attr('src')
>                },
>                "links" :  getAnchorLinks(li)
>        };
>        return item;
> };
>
>
> Anyone else experiencing drops in speed with 1.3.1 doing simple stuff
> like this?
> Sure, I was not expecting any major speed increase since the code is
> not optimized yet, but an 80% drop is just crazy...
>
> Please advice,
> /Johan
>
>

Reply via email to