Tuesday, March 15, 2011

Why does my website need so much time to render?

Hi all,

I need to make some performance improvements on a web site and made some major improvements, but now I stuck with a strange problem.

When cached, my starting page only needs to load one element (the "root document") - but then it needs some time until it's rendered completely:

alt text

The elements following are things loaded asynchronous via JavaScript.

Two questions:

  1. why does it take so "long" from loading the root document until the DomContentLoaded-event?
  2. does it make sense to load some not so important things asynchronous? I mean - is it important to have the DmoContentLoaded-event as early as possible? Unfortunately there's not much documentation about that event, but I don't think it's the moment when the page is displayed, is it?

Thanks a LOT for all your help and answers,

Stefan

From stackoverflow
  • I'm not sure YSlow is gonna help him as that will download all elements for a page and run performance tests on them, whereas swalkner's problem is how long it is taking to render the HTML page itself when all other elements (images, CSS, etc) are cached.

    At least that's what I think he's saying.

    In the original question you said, "The elements following are things loaded asynchronous via JavaScript." but then listed nothing. What is loaded?

    I would suggest checking for Javascript errors in the first instance. Then try removing some of your asynchronous loading calls one by one until you hit the bottleneck. In fact, remove them all, how long does the downloaded HTML take to render? Take that time and work from there.

    Is your HTML document very big? Does it use lots of inline styles that could be in the CSS file?

    Perhaps if you posted a link to the site then people would have a look at it.

    swalkner : thanks a lot for your input - but there are no JS errors... iframes are asynchronously loaded with content of external websites (financial data, for example). unfortunately i can't give you a link as the website is company-internal only...

0 comments:

Post a Comment