Hugo Rodger-Brown
Hugo Rodger-Brown

Reputation: 11582

How can I measure the render time of a web app that uses dynamic async calls to load the page?

I am trying to measure the performance of a web app that is currently very slow to load. (Need to set a baseline for future improvements.) The problem that I am having is that the tools I would usually use measure the load time of the HTML document, and / or the time taken for the onLoad event to fire. In this particular case neither seems appropriate - as the HTML page is essentially empty, and downloads in <1sec.

The blocker at the moment is a dynamic json POST that is run on page load (don't ask) - but as this fires async, there's no hook to use to measure when it is complete, beyond looking at Firebug (which isn't very scalable or easy to automate).

Any help most gratefully received.

[Edit] I'm really looking for something that can be run as a service - if Pingdom could do what I wanted it would be perfect. The challenge is that the timing I'm looking for is based on a dependent request, not the original HTML page request, and I can't find a tool to do that for me.

Upvotes: 0

Views: 1304

Answers (2)

ccoakley
ccoakley

Reputation: 3255

Is there something you can check in each ajax return or the rendering code that uses the ajax returns? If so, just set up a simple poll to see if they've all rendered. Element ids or unique xpath expressions can be your friend while testing.

Out of curiosity, are you using Selenium? The YUI profiler? Just firebug?

Upvotes: 2

Rudie
Rudie

Reputation: 53821

You can get the load time of Ajax requests very simply with Javascript:

var start = +new Date(); // Yeah, that's not a typo
// ajax request
complete: function() {
  // do response stuff
  var rtt = +new Date() - start; // rtt in milliseconds
  // or do response stuff here
}
// ajax request

That what you were looking for?

What do you want to do with it? Send it back to the server? =)

If you're using a library, it might be built in. If you're using a library and it's not built in, you can do it yourself with the start event (they usually have one) and the end event (usually "complete").

Upvotes: 0

Related Questions