简体   繁体   中英

Difference between timeDone in RT plugin in boomerang vc navigation timing page load time

I use boomerang.js for monitoring web site performance for my real users for my site. http://lognormal.github.io/boomerang/doc/

It has a RTPlugin http://lognormal.github.io/boomerang/doc/api/RT.html which measures timeDone (perceived page load time ).

There is also navigationg timing api that boomerang supports for browsers that support navigation timing. Using navigation timing we can calculate page load time using:

totalTime = loadEventEnd - NavigationStart

https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html#processing-model

totalTime and timeDone are different numbers when I look at the data more closely and timeDone is always more than totalTime

My questions are

  1. Which one of the two is a right metric for finding out when the page is loaded ?
  2. What does RT plugin do more than what navigation timing captures ?
  3. When should we use which metric and why ?

Thanks Kunal

good to see you here :)

Which number is correct depends on what you're measuring. If you're measuring when onload fires and let boomerang fire the event on its own, then the two numbers are generally the same since tdone uses the same math mentioned above. See this code in the done() method:

if(impl.navigationStart) {
    t_start = impl.navigationStart;
}

( https://github.com/lognormal/boomerang/blob/master/plugins/rt.js#L368 )

impl.navigationStart is equal to window.performance.navigationStart except in cases when a browser bug results in navigationStart being wrong or non-existent. In those cases boomerang falls back to other values (see source for more details).

The end time is actually the time when the done() method is called. By default this is called in the page's onload method, but you can override this.

Many sites have pages that are considered "complete" (user usable) before the onload event fires, so you may want to call boomerang's BOOMR.page_ready method at that time.

Similarly, some sites load all of their content after onload, and you may wait until that time to call page_ready.

The last case is when a page is prerendered by Google Chrome. In this case the onload event fires, but the page is not usable by the user. We wait until the page moves from a prerender state to a visible state before capturing the time (and in this case we capture all transitions).

Hope this answers your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM