>
> What is the reason why navigation timing entries notification should use
> microtasks and not tasks? Or actually, maybe it should
> use animation frame ticks?
>
This concern I think is obviated by the PerformanceObserver proposal.
In an earlier proposal, we were trying to specify when events arrived to
the timeline, so consumers of the buffer could know when to check for the
event. The risk there is that it would lock the browser into event
buffering behaviors that were in-conflict with our desire for the perfmon
api to be non-intrusive.
Correct me if I'm wrong, ilya, but the reason I think we were looking at
specifying when events are inserted in the timeline was because there were
no callbacks when events were actually inserted. This made it hard for JS
to "await" a navigation event.
In PerformanceObserver, you would make an observer for nav events, listen
to its callback and then disconnect when they arrived. In that model, its
up to the browser when to deliver those callbacks, which lets us defer
their delivery as long as we think is necessary to get good performance.
That's much better for performance.
Ilya: to your point, having observers always get notifications sounds
great. But, if so, I wonder if we can figure out how we can specify things
like frame-timing events to never add to the buffer in the first place.
Since they have nonzero overhead to collect, we'd be avoiding a footgun if
they're only obtainable via observers.