Loading ...
Sorry, an error occurred while loading the content.
 

Re: [ydn-javascript] FF3 takes around 2 secs, IE7 around 30

Expand Messages
  • Christian Tiberg
    I solved this in the worst manner possible. Only FF gets full functionality, IE gets a reduced and quicker version. Thanks anyways. It s not easy to make a
    Message 1 of 6 , Aug 21, 2008
      I solved this in the worst manner possible. Only FF gets full functionality, IE gets a reduced and quicker version. Thanks anyways.

      It's not easy to make a test page out of this, it's a part of a relatively large and complex system :(

      Best regards,
      Christian Tiberg


      2008/8/21 Dav Glass <dav.glass@...>

      Christian --

      Can you please post a link to your test page..
      + Windows: n. - The most successful computer virus, ever. +
      + A computer without a Microsoft operating system is like a dog
      without bricks tied to its head +
      + A Microsoft Certified Systems Engineer is to computing what a
      McDonalds Certified Food Specialist is to fine cuisine +


      ----- Original Message ----
      From: Christian Tiberg <ctiberg@...>
      To: ydn-javascript@yahoogroups.com
      Sent: Thursday, August 21, 2008 2:00:35 AM
      Subject: Re: [ydn-javascript] FF3 takes around 2 secs, IE7 around 30

      Hello Dav and Satyam!

      Thanks for your responses!

      First about the innerHTML part. Changing the whole thing to use innerHTML resulted in execution time going *UP* to 48 secs in IE, untested in FF.

      Setting display: none reduced the time down to about 17s, still not acceptable, but better. Thanks for that pointer.

      I've now added profiling for the DDList constructor, and that takes 12216 ms of the total 19910 ms. Any hints for speeding up that bit?

      I've also removed the Element creation and use DOM (getElementById) instead.

      Best regards,
      Christian Tiberg


      2008/8/21 Satyam <satyam@...>

      The time spent on that code will vary greatly depending on whether ulF
      is already part of the document or not. If it is part of the document,
      the browser has to recalculate the layout of the page with every
      addition. Different browsers will show big differences in performance.
      If ulF is not yet attached to the document, the rendering engine is not
      called at all, not until the end when the whole branch is attached and
      then the layout is calculated just once. If the ulF element exists, you
      may hide it (display:none), the renderer will also ignore it until you
      set it back to visible. Unfortunately, this is not always possible
      since sometimes you have calculations involving the position of the
      elements and, if it is not attached to the document or hidden, it has no
      position, but that doesn't seem to be the case here.

      Also, the methods you are using of Element are really wrappers for DOM
      methods, many of them of the same name and functionality. You are
      gaining nothing by using Element here.

      Satyam



      Christian Tiberg wrote:
      > Hello!
      >
      > The following code is executed around 900 times in order to populate
      > two drag&drop UL's.
      >
      > var ulF = new YAHOO.util.Element(ulFran);
      > while (ulF.hasChildNodes()) ulF.removeChild(ulF.get('firstChild'));
      > for (var i=0; i<lst.length; i++)
      > if (!redanValdDD(redanValda, lst[i].Artikelnr))
      > {
      > var li = document.createElement("LI");
      > li.id <http://li.id> = ulFran + "_" + i;

      > li.artikelnr = lst[i].Artikelnr;
      > li.innerHTML = produktDDTag(lst[i]);
      > ulF.appendChild(li);
      > new DDList(li.id <http://li.id>);

      > }
      >
      > The call to produktDDTag is not the culprit, according to the
      > profiler. The majority of the time is spent in the DDList constructor,
      > and in adding the elements to the UL.
      >
      > How can the same code be so hugely different in execution time? Am I
      > doing something horrendously wrong, or is there a way to simply do it
      > faster? The DDList constructor is copied from one of the YUI examples.
      >
      > Best regards,
      > Christian Tiberg
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.138 / Virus Database: 270.6.6/1623 - Release Date: 20/08/2008 8:12
      >


    Your message has been successfully submitted and would be delivered to recipients shortly.