Firefox and User Timing API in workers

Hi all,

I have recently worked on the porting of user timing API in workers in
Firefox. The reason why this is needed is because it will allow the user to
do some useful benchmark when content is loaded and managed from/by
ServiceWorkers. But it's also useful for performance analysis of worker

This code is not landed yet because I thought that was important to inform
you first. As the user timing API, from the spec point of view, should not
exposed to workers.

As probably you know, Firefox already has in workers
(Workers, Shared Workers, Service Workers). And now we expose all the User
Timing interfaces:

PerformanceMark, PerformanceMeasure, PerformanceEntry and the partial
Performance interface as described by the point 4.2:

Our implementation is here:

Important points in our code are:

1. all the PerformanceEntry buffers/queue are per thread: marks are not
shared between worker and main-thread or workers and other workers. They
are owned by the performance object exposed in the Worker global scope.
This also means that performance.clearMarks() removes the existing marks
only in the current performance object.

2. PerformanceTiming is not exposed to workers. The only attribute that can
be used as marker name is 'navigationStart'.

3. navigationStart is taken from the window PerformanceTiming object when
the worker is created.
For window-less workers (SharedWorkers, ServiceWorkers) navigationStart is
the creation time of the worker itself.

4. uses the navigationStart as described by point 3.

We would like to have a feedback from your working group before shipping
the code I just described.

Thank you in advance.

Best Regards,

Received on Friday, 22 May 2015 11:19:07 UTC