w3c / event-timing

A proposal for an Event Timing specification.
https://w3c.github.io/event-timing/
Other
44 stars 13 forks source link

Consider exposing renderTime to Event Timing #131

Open mmocny opened 1 year ago

mmocny commented 1 year ago

Element timing already exposes a renderTime property, which matches the same concept that Event Timing uses for measuring duration.

However, Event Timing does not actually expose the renderTime. Instead, Event Timing using startTime == event.timeStamp, and exposes a duration == (renderTime - startTime), rounded to the nearest 8ms.

Common advice in JS is to: let renderTime = startTime + duration to work around this.

Computing renderTime is useful in order to:

Unfortunately, the fact that we round duration to 8ms makes this difficult. Because each event may have a unique timeStamp, renderTime can end up with awkward offsets.

See Screenshot, which showcases User Timings of Event Timing (above) and real trace events with accurate times (below): Screenshot 2023-02-01 at 9 50 44 PM

Notice the staggered end time, and also that the last event appears to end earlier.. because it was rounded down instead of rounded up like the others.

Consider just exposing renderTime to Event Timing. It could still be rounded to 8ms, but it would be the same value for all events which appear in the same paint.