Forum Moderators: open

Message Too Old, No Replies

How does Javascript affect page load times?

         

NubKnacker2k

2:35 am on Jan 21, 2006 (gmt 0)

10+ Year Member



I'm in the process of make a site which might require extensive use of javascript. I was wondering if anyone had done any experiments with how the amount of javascript affects page load times. I assume it's dependent on the browser as well so that info would be nice too. :)

Thanks.

Leosghost

2:44 am on Jan 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Lots of .js affects load times hardly at all ..it does however slow older CPU's

DrDoc

7:30 pm on Jan 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, lots of JS does affect load time, since it has to be downloaded from the server. So, on a slow connection, a huge JavaScript will significantly affect the time it takes to load the page (believe me, I know ... since I've had pages with 500K scripts on them).

It should not, however, affect the time it takes to render the page (unless, of course, the script itself renders stuff as it loads).

rocknbil

8:22 pm on Jan 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



unless, of course, the script itself renders stuff as it loads

. . . as in a LOT of document.write() statements for example. Like more than 100, even if the JS itself loads in milliseconds.

DrDoc

10:50 pm on Jan 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or, if the code generates massive tables (which can be accomplished with a both short script and very few document.write statements)

Leosghost

11:03 am on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



for me ..extensive and lots means around 20k ..javascripts that ( even in "combo") come in at 500k is just greedy ;)

Rambo Tribble

4:09 pm on Jan 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are a lot of variables affecting load times. Separate .js files require a separate HTTP request, with associated slow-start transmission phase, etc. This can easily be more than made up for if the scripts are shared among pages, as the cacheing of the .js file will obviate the need for it to be retransmitted. If inline JS forces a page to be divided into additional packets, additional transmission overhead ensues. The effect of these things will, of course, be more pronounced on a slow connection.