Make WordPress Core

Opened 8 months ago

Last modified 6 months ago

#59120 new defect (bug)

Measure interactivity metrics in performance tests

Reported by: swissspidy's profile swissspidy Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords:
Focuses: performance Cc:

Description

This is a follow-up to #58360.

While we have some good load time metrics so far, we don't measure interactivity metrics yet.

We're particularly looking at these 3 metrics:

They can be measured using libraries like Lighthouse or https://github.com/GoogleChrome/web-vitals.

Interactivity metrics require some sort of interaction during the test, so we need to figure out specifics.

Change History (1)

#1 @swissspidy
6 months ago

Note that TBT is a lab metric that is not covered by web-vitals.js

In JS it could be done with something like

var totalBlockingTime = 0;
var observer = new PerformanceObserver(function (list) {
  let perfEntries = list.getEntries();
  for (const perfEntry of perfEntries) {
    totalBlockingTime += perfEntry.duration - 50;
  }
  console.log({ totalBlockingTime });
});
observer.observe({ type: "longtask", buffered: true });

(source)

Note: See TracTickets for help on using tickets.