Re: RFC: WebApp timing

Hi, Gregg,

On Thu, Aug 13, 2009 at 12:07 AM, Gregg Tavares <gman@google.com> wrote:

>
>
> On Wed, Aug 12, 2009 at 6:12 PM, Zhiheng Wang <zhihengw@google.com> wrote:
>
>> Hello,
>>
>>    We recently started a draft to provide timing-related APIs in browsers.
>> The goal is to add the missing pieces in webapp latency measurements
>> using Javascript. As a starter, right now we've only include a
>> minimum set of interfaces we consider necessary, which mainly focuse on
>> the time and type of the
>> navigation.
>>
>>    The first cut of the draft is attached below. It's sketchy but should
>> hold much of our ideas. We are
>> still actively working on it. Any interest and feedback on the draft are
>> highly welcome.
>>
>
> Is this a place that app specific timing would be useful to add or is that
> already covered somewhere else?
>
> In other words, I'm looking for an API that helps me do this
>
> var timer = new Timer();
> timer.start();
> for (var x = 0; x < 10; ++x) { }
> var elapsedTime = timer.elapsedTime;
> document.write("loop took " + elapsedTime + " seconds");
>
> Where elapsedTime is some relatively high precision number so this might
> print
>
> loop took 0.00000145 seconds
>
> (using Date, which only has a precision of milliseconds, is not enough)
>

    This is indeed something we have been debating: shall we require a high
res timer or not. To enable that, the value of the
property should be a floating number in either second or msec. We currently
opt for keeping it as int in msec to make it
slightly more consistent with the JS Date.getTime(). And, also, msec
resolution seems to be sufficient in terms of measuring
page loading latency.

   That said, if there is enough interest in pursuing a finer res timer, we
can definitely account for that.

thanks,
Zhiheng



>
>
>
>>
>> cheers,
>> Zhiheng
>>
>
>

Received on Thursday, 13 August 2009 10:01:10 UTC