"Fabian" <la****@hotmail.com> wrote in message
news:bs************@ID-174912.news.uni-berlin.de...
I notice on [ ... ] that the writer has measured the
time taken to run the script down to the millisecond.
Does anyone know what tools he used to calculate these
load times?
Instances of the Date object, they do not produce millisecond values
with a precision of less than about 10 milliseconds (and that varies by
OS) so timing operations would usually involve repeating the operation
sufficiently often and then dividing the interval by the number of times
the operation was repeated. Possibly also calculating the overhead
involved in the actual testing, including the looping, and probably
repeating the tests to reduce the influence of background tasks on
multitasking OSs.
It probably doesn't make sense to talk of timing scripts (at least in an
event driven browser context), more likely functions or sets of (or
individual) operations.
I have found that a limiting factor in repeatedly executing the same
code in a loop is the browser's tendency to put up a dialog saying
something like "a script on this page is causing the browser to run
slowly", which renders any results meaningless. However, I tend to
increase the number of iterations of the tested code until that dialog
is reported (in the browsers that do so) and then drop back just under
that limit so the average timings are as representative as they can be.
The relative efficiency of various operations is often debated here so a
well-phrased groups.google.com search of c.l.j should turn up numerous
examples of test pages/scripts.
Richard.