Chrome Performance API Related Issue (Performance.getMetrics)

77 views
Skip to first unread message

Manu Bansal

unread,
Jun 21, 2024, 1:19:21 PM (11 days ago) Jun 21
to Chromium-dev
Hello Chromium Developer Community,
 
I want to use the performance API (Performance.getMetrics) in my project due to project requirement, but I want to know that for same URL every time performance data differs why? 
   

First Time Data : -
 {'metrics': [{'name': 'Timestamp', 'value': 73605.596278}, {'name': 'AudioHandlers', 'value': 0}, {'name': 'AudioWorkletProcessors', 'value': 0}, {'name': 'Documents', 'value': 36}, {'name': 'Frames', 'value': 29}, {'name': 'JSEventListeners', 'value': 1179}, {'name': 'LayoutObjects', 'value': 1172}, {'name': 'MediaKeySessions', 'value': 0}, {'name': 'MediaKeys', 'value': 0}, {'name': 'Nodes', 'value': 5957}, {'name': 'Resources', 'value': 244}, {'name': 'ContextLifecycleStateObservers', 'value': 49}, {'name': 'V8PerContextDatas', 'value': 5}, {'name': 'WorkerGlobalScopes', 'value': 0}, {'name': 'UACSSResources', 'value': 0}, {'name': 'RTCPeerConnections', 'value': 0}, {'name': 'ResourceFetchers', 'value': 36}, {'name': 'AdSubframes', 'value': 0}, {'name': 'DetachedScriptStates', 'value': 2}, {'name': 'ArrayBufferContents', 'value': 11}, {'name': 'LayoutCount', 'value': 1}, {'name': 'RecalcStyleCount', 'value': 1}, {'name': 'LayoutDuration', 'value': 0.00016}, {'name': 'RecalcStyleDuration', 'value': 0.00011}, {'name': 'DevToolsCommandDuration', 'value': 0.000395}, {'name': 'ScriptDuration', 'value': 0.012728}, {'name': 'V8CompileDuration', 'value': 0}, {'name': 'TaskDuration', 'value': 0.014663}, {'name': 'TaskOtherDuration', 'value': 0.00127}, {'name': 'ThreadTime', 'value': 0.014476}, {'name': 'ProcessTime', 'value': 5.346106}, {'name': 'JSHeapUsedSize', 'value': 32554024}, {'name': 'JSHeapTotalSize', 'value': 50491392}, {'name': 'FirstMeaningfulPaint', 'value': 0}, {'name': 'DomContentLoaded', 'value': 73601.309227}, {'name': 'NavigationStart', 'value': 73599.927473}]}         

Second Time Data :-
 {'metrics': [{'name': 'Timestamp', 'value': 73621.246937}, {'name': 'AudioHandlers', 'value': 0}, {'name': 'AudioWorkletProcessors', 'value': 0}, {'name': 'Documents', 'value': 36}, {'name': 'Frames', 'value': 28}, {'name': 'JSEventListeners', 'value': 1169}, {'name': 'LayoutObjects', 'value': 1180}, {'name': 'MediaKeySessions', 'value': 0}, {'name': 'MediaKeys', 'value': 0}, {'name': 'Nodes', 'value': 5979}, {'name': 'Resources', 'value': 242}, {'name': 'ContextLifecycleStateObservers', 'value': 49}, {'name': 'V8PerContextDatas', 'value': 5}, {'name': 'WorkerGlobalScopes', 'value': 0}, {'name': 'UACSSResources', 'value': 0}, {'name': 'RTCPeerConnections', 'value': 0}, {'name': 'ResourceFetchers', 'value': 36}, {'name': 'AdSubframes', 'value': 0}, {'name': 'DetachedScriptStates', 'value': 1}, {'name': 'ArrayBufferContents', 'value': 11}, {'name': 'LayoutCount', 'value': 2}, {'name': 'RecalcStyleCount', 'value': 2}, {'name': 'LayoutDuration', 'value': 0.000307}, {'name': 'RecalcStyleDuration', 'value': 0.000186}, {'name': 'DevToolsCommandDuration', 'value': 0.000158}, {'name': 'ScriptDuration', 'value': 0.014549}, {'name': 'V8CompileDuration', 'value': 3.1e-05}, {'name': 'TaskDuration', 'value': 0.0175}, {'name': 'TaskOtherDuration', 'value': 0.002269}, {'name': 'ThreadTime', 'value': 0.016694}, {'name': 'ProcessTime', 'value': 5.1243}, {'name': 'JSHeapUsedSize', 'value': 35158144}, {'name': 'JSHeapTotalSize', 'value': 49704960}, {'name': 'FirstMeaningfulPaint', 'value': 0}, {'name': 'DomContentLoaded', 'value': 73617.036242}, {'name': 'NavigationStart', 'value': 73615.71325}]}           

So please, work on this tell me the issue

PhistucK

unread,
Jun 21, 2024, 2:07:16 PM (11 days ago) Jun 21
to manuban...@gmail.com, Chromium-dev
I reckon it depends on the load of the system. So maybe some small process/thread/task ran/did not run in the background by the operating system/browser/something else during the second run?

PhistucK


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/fd201023-2d83-44e1-9356-9cecc31e63adn%40chromium.org.

Ian Clelland

unread,
Jun 24, 2024, 10:53:59 AM (9 days ago) Jun 24
to phis...@gmail.com, manuban...@gmail.com, Chromium-dev
That's pretty much correct. The metrics that Chrome collects during the loading of the page, which you're seeing through that API, reflect how the time was spent loading that one page, one time, on your computer. Every time the page loads, even on the same computer, we would expect those values to be slightly different, for a large number of factors:
  • Chrome's scheduler may execute tasks in a different order
  • Other tabs loaded in Chrome could be using system resources
  • Other applications running on the computer could be using system resources
  • The operating system could be doing different things while the page loaded
  • There may be more or less traffic on the network
Very often, a second page load is faster than the first -
  • Chrome has seen the page before, and has cached some resources
  • Your computer or router has already resolved all of the DNS addresses
  • The site's CDN has cached the page, and can serve it more quickly
  • The site itself has cached the page, and can serve it more quickly

For these reasons (and more) we wouldn't expect any of the metrics to have a single consistent value. The best way to get an idea of how fast a page is is to load it many times, under different conditions, and find an average. There are companies which will do this as a service, or you can look up some of the metrics for popular pages on the Chrome User Experience Report, which is compiled from performance data sent to Google from Chrome users.

Reply all
Reply to author
Forward
0 new messages