Flutterby™! : Timing AJAX

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Timing AJAX

2008-08-20 00:59:29.819613+00 by ebradway 8 comments

I'm writing a paper about geoprocessing in AJAX. I want to benchmark some JavaScript but the Date.GetTime() function has a variable implementation and may only be updated every 55ms or so. Any ideas?

[ related topics: Writing Mathematics ]

comments in ascending chronological order (reverse):

#Comment Re: made: 2008-08-20 09:40:48.184451+00 by: meuon

Run it on a very slow machine.. and use a stopwatch? More seriously: Depending on what you mean by Ajax, if there is a server side process that you are calling and processing the results from, clocking the server side could be fairly easy. Clocking the browser.. No clues.

#Comment Re: made: 2008-08-20 12:36:22.051366+00 by: spl

Does the Firebug timer (under the "Net" tab) help here? I know it shows you download times, but I don't know about XHR times. Also, there's Cuzillion by this guy whose specialty is fast websites and whose current focus is on frontend speed.

#Comment Re: made: 2008-08-20 15:02:40.228406+00 by: Dan Lyke

Given that JavaScript is running on enough layers of crap to introduce at least 55ms of jitter into your average benchmark, I think you just need to run enough iterations that 55ms isn't significant any more.

#Comment Re: made: 2008-08-20 16:11:33.521837+00 by: ebradway

I'm looking at client-side computational speeds. The current solution is, as Dan suggested, running enough iterations to average out the 55ms. Oddly, it's not because of the layers of crap - it's an implementation detail for JavaScript. Evidently the Date object doesn't directly access any kind of system time and is updated independently with no real spec as to how often it should be updated.

Another odd thing: in searching the academic literature, one of the few publications I came across for benchmarking AJAX was:

  1. W. Smullen and S. A. Smullen, "AJAX Application Server Performance," in SoutheastCon, Richmond, VA, 2007, pp. 154-158.

Yep - Clinton and Stephanie Smullen from UTC!

#Comment Re: made: 2008-08-20 17:46:33.832891+00 by: Dan Lyke

Well, if you dig really deep into the bowls of the x86 architecture as it has descended from the original IBM PC, that 55ms number makes a lot of sense, because there's a timer that overflows 18.whatever times per second and generates a DOS level interrupt, and for compatibility's sake that interrupt has been dragged forward through Windows.

#Comment Re: made: 2008-08-25 00:07:30.841868+00 by: John Anderson

Did you look at the Jiffy plugin[1] for Firebug?

[1] <http://billwscott.com/jiffyext/>

I haven't used it at all, but it has pretty short (5ms) times shown in the screenshot on the front page, so it may be worth a shot.

#Comment Re: made: 2008-08-25 01:38:42.259602+00 by: Dan Lyke

Dang it, John, now there's another set of markup I've got to make Flutterby understand... [grin]

#Comment Re: made: 2008-08-25 11:49:41.174151+00 by: meuon

I learned what I already felt. JavaScript can easily be a pig. And I put some of mine on a diet. :)

Thanks for the "link" John.