Alternate User Timing API

Hey,

So I've been using the user timing api for a bit and I'm slowly starting to
think that the current API might not be optimal.

Here is my use case:
I have one async function that starts a cascade of other async functions,
and each of those functions can also start more functions. To "start" a new
function, all of my functions use a utility method.

I've rigged this utility method so that it will time each of the async
functions and log with the User Timing API. However, the current API
requires a unique string to be provided when recording "marks" and those
strings are needed again to record a "measure." Right now I'm using the
function names as the unique string but since these functions can be
executed multiple times asynchronously, the measures are incorrect.

I want to propose an API where a call to `performance.mark()` returns a
unique javascript object, lets call it a marker. And when I call
`performance.measure()` I should be able to pass to it two markers and have
it record the time between the markers.


Right now, my workaround is to build a wrapper around `performance.mark`
and `performance.measure` to provide the API I suggested above, while
handling name collisions and using the current API under the hood. It is
turning out to be more work than I'd like.

I have no idea how far along the User Timing Spec is but does this sound
reasonable to consider?

Rajiv,
Software Engineer, Yahoo

Received on Tuesday, 24 November 2015 16:09:02 UTC