views:

576

answers:

10

How to write a code (in any programming language, preferably in java), which calculates the average loading time of any website (including all embedded elements such as images, Javascript, CSS, etc.) ?

+1  A: 

I've always enjoyed using this tool: http://www.websiteoptimization.com/services/analyze/

barfoon
+5  A: 

I'd just use YSlow

Jeremy Coenen
+1  A: 

I think websiteoptimization.com has all you need :)

Steven
Right.... barfoon posted while I was typing.Try it. It gives you great feedback.
Steven
I am interested in programmatic implementtion of same.
Silent Warrior
Right. I found this javascript code, but have not tested it: http://www.dreamincode.net/code/snippet1908.htm
Steven
A: 

Depends what you mean by 'average loading time'.

If you sit at your PC with your site running locally and just hit F5 over and over again you'll get considerably different results to someone looking at the same code which is deployed in a data centre on the other side of the world.

Visage
+1  A: 

Fiddler is also another option. See the Fiddler home page

A nice screenshot of the transfer timeline is here.

Chris W. Rea
+3  A: 

Google just released Page Speed (a plug-in for firebug, just like YSlow) and it's got some pretty cool features.

Adrian Mester
That's new to me- I wonder how it compares to YSlow.
RichardOD
A: 

This has a nice JavaScript way to check load time of a web page: http://javascript.internet.com/text-effects/loading-time-indicator.html

Ascalonian
A: 

I had used souptag framework to parse html page and then found individual src attribute of all the tags, Then individually found size of each page mentioned in src attribute and then according to my internet speed found out average loading time.

Silent Warrior
A: 

Perceived loading time is important too. External scripts will delay rendering of everything below them until they've loaded and executed, in all browsers, so it's best to push them to the very bottom of the page when possible, as opposed to the very top which is the habit of many developers. Another source of delay in some browsers is img tags where the width and height are unspecified. The browser will give the image some time to load so that it can get the layout right the first try. Fixing both those issues will make your site appear a lot more responsive, even if total loading time is unchanged.

David
A: 

Nice one...very helpful.