I've googled, searched through SO, and read through the Navigation Timing page recommended on the host page, but was unable to resolve on my own.
What is the difference between :response_time
, :time_to_first_byte
, and :time_to_last_byte
?
From my understanding, as well as the Navigation Timing documentation, it seems :response_time
should be the sum of :time_to_first_byte
, and :time_to_last_byte
, however upon executing my tests I've found it isn't.
require 'watir-webdriver-performance'
$response = $browser.performance.summary[:response_time]
$first_byte = $browser.performance.summary[:time_to_first_byte]
$last_byte = $browser.performance.summary[:time_to_last_byte]
def performance_check
puts ("#{$browser.url}: Response time: #{$response}ms.")
puts ("#{$browser.url}: Time to first byte: #{$first_byte}ms.")
puts ("#{$browser.url}: Time to last byte: #{$last_byte}ms.")
end
def test_site_01
$browser.goto("http://www.google.com/")
performance_check
end
The typical output I'm seeing is:
http://www.google.com: Response time: 1558ms.
http://www.google.com: Time to first byte: 384ms.
http://www.google.com: Time to last byte: 385ms.
Thank you.