lundi 21 septembre 2020

Calculating Front end performance metrics via Web API's ( navigation API and performance timeline API)

In order to calculate the first contentful paint , i used the below command in my browser console.

'window.performance.getEntriesByType('paint')' -> From that , i fetched the start time of first contentful paint which is : startTime: 710.1449999972829 ms.

Reference: https://developer.mozilla.org/en-US/docs/Web/API/PerformancePaintTiming#:~:text=The%20code%20above%20produces%20console,contentful%2Dpaint%20was%202787.460%20milliseconds.

But if audit the same page via lighthouse(from chrome dev tools), the first contentful paint calculated by lighthouse is '1.5 s'

I am trying to understand why there is a wide difference between the two data. Tried running the audit couple of times via lighthouse, still the data hardy matches with web api data.

Can anyone explain me as to why there is huge difference. Should i go ahead with the data from web api's or should i consider lighthouse data as valid one?

Aucun commentaire:

Enregistrer un commentaire