SlideShare a Scribd company logo
State of the Resource Timing API
Aaron Peters
aaron@turbobytes.com
WebPerfDays Amsterdam, May 18 2013
What is the Resource Timing API?
API in the browser that exposes load time data for page
resources. "Navigation Timing API for for page objects"
How get timing data via the API?
window.performance.getEntriesByType("resource")[1] {
connectEnd: 298.0000000097789
connectStart: 298.0000000097789
domainLookupEnd: 298.0000000097789
domainLookupStart: 298.0000000097789
duration: 682.9999999608845
entryType: "resource"
fetchStart: 298.0000000097789
initiatorType: "css"
name: "http://st.cdnplanet.com/static/fonts/amaranth-bold-webfont.woff"
redirectEnd: 0
redirectStart: 0
requestStart: 946.9999999962747
responseEnd: 980.9999999706633
responseStart: 962.9999999962747
secureConnectionStart: 0
startTime: 298.0000000097789
}
Is the API ready for use?
Spec is not final yet. W3C Candidate Recommendation
API currently implemented in a few browsers:
● IE10
● Chrome, Chrome Mobile, Chrome Frame
Does it behave constistently & according to the spec?
12 things you should know
when using the API
When does the API make data
available for a resource?
While it's loading (OMG!)
Bug? Yes, but useful
"Did main.css finish
loading within 5 seconds?"
After the resource has
finished loading
This is according to spec
Timing-Allow-Origin: must be *
Spec states: T-A-O must be either origin-list-or-null
(RFC 6454) or *
In both browsers, only * works.
This does not work today:
● host: www.aaronpeters.nl
● scheme + host: http://www.aaronpeters.nl/
● scheme + host + port: http://www.aaronpeters.nl:
80/
Detect browser disk cache hits
Yes, you can!
if(
requestStart == fetchStart &&
requestStart == responseStart &&
responseStart != responseEnd
) { // disk cache hit }
Note: IE10 Dev Tools shows 304 when
actually is a disk cache hit.
Yes, you can!
if(
domainLookupStart != 0 &&
requestStart == 0
) { //disk cache hit }
Chrome says it's a bug, I
say it is a feature
Browser memory cache hits?
Not exposed by the API:
there is no data for the
resource
This is a bug
???
I have no idea how to test
for a memory cache hit in
IE10
Detect 4xx/5xx responses?
Not exposed by the API:
there is no data for the
resource
This is a bug
Data available via API
Looks same as cross-origin
200 response without
valid T-A-O header: all
timing attributes equal
zero, except startTime,
fetchStart, duration and
responseEnd
domainLookupStart = 0, huh?
Sometimes, in Chrome, domainLookupStart = 0,
even when a valid Timing-Allow-Header is present.
This is always impossible.
if(domainLookupStart < fetchStart){ // abort! }
DNS lookup & Connect times
unavailable in IE10
Values of the 4 relevant attributes are
always zero.
It's a bug.
IE10, y u no show SSL time?
sslTime = connectEnd -
secureConnectionStart
Chrome's behavior is in
line with Navigation
Timing API behavior, but
Resource Timing spec has
conflicting info. That will
be fixed.
Not exposed by the API
secureConnectionStart
attribute is not present !
Actually, the attribute is
optional according to the
spec
Track 'wait time'
How long is a resource in queue, waiting to be fetched?
If many resources have high waitTime, there is an
optimization opportunity (domain sharding?)
if(connectEnd == fetchStart){
waitTime = requestStart - connectEnd
} else {
waitTime = domainLookupStart - fetchStart
}
duration is useless
Same origin resource ||
valid T-A-O header
Has no added value.
What specific insight can
be gained from duration?
Cross-origin resource
No insight in split between
'wait time' and 'load time',
so how can duration
possibly be informative?
duration = responseEnd - startTime
Ignore all data in Chrome Frame
Data is exposed by the API, but it's bad data.
Objects fetched over network 'look' like browser disk
cache hits
if(!window.externalHost){ // not Chrome Frame }
Bytesize is not exposed :(
You can't know how many bytes were transferred.
A deliberate 'feature', for security reasons.
I strongly disagree. Knowing the bytesize is essential
for understanding resource load time.
Why not make it opt-in to expose bytesize?
Let the publisher be in control!
This discussion with the Working Group is not finished!
Some final remarks
Chrome currently uses a vendor prefix, eg.
webkitGetEntriesByType("resource")
When they switch to Blink, the prefix will be gone
Firefox will support the API soon(-ish), likely sans prefix.
Low activity on bug 822480
Safari & Opera will likely not have the API anytime soon:
they don't even support Navigation Timing API !
Future browser support
if one value doesn't make sense, discard all values
Be safe
Thank you !
Aaron Peters
aaron@turbobytes.com
WebPerfDays Amsterdam, May 18 2013
www.aaronpeters.nl/blog/state-of-resource-timing-api

More Related Content

What's hot (20)

PPTX
@media - Even Faster Web Sites
Steve Souders
 
PPTX
How fast are we going now?
Steve Souders
 
PPTX
Browser Wars Episode 1: The Phantom Menace
Nicholas Zakas
 
PDF
Frontend SPOF
Patrick Meenan
 
PPTX
do u webview?
Steve Souders
 
PPTX
Your Script Just Killed My Site
Steve Souders
 
PPTX
Web Directions South - Even Faster Web Sites
Steve Souders
 
PPTX
High Performance JavaScript (CapitolJS 2011)
Nicholas Zakas
 
PPTX
High Performance Snippets
Steve Souders
 
PDF
Progressive Enhancement 2.0 (Conference Agnostic)
Nicholas Zakas
 
PDF
Metrics of Joy
Steve Souders
 
PPTX
Cache is King
Steve Souders
 
PPT
Oscon 20080724
linkedin_resptest2
 
PDF
Preconnect, prefetch, prerender...
MilanAryal
 
PDF
Going Node At Netflix
Ryan Anklam
 
PDF
Fast Fashion… How Missguided revolutionised their approach to site performanc...
Andy Davies
 
PDF
High Performance JavaScript (Amazon DevCon 2011)
Nicholas Zakas
 
PDF
Front End Development for Back End Developers - vJUG24 2017
Matt Raible
 
PPT
Web20expo 20080425
Media Gorod
 
PDF
Web Page Test - Beyond the Basics
Andy Davies
 
@media - Even Faster Web Sites
Steve Souders
 
How fast are we going now?
Steve Souders
 
Browser Wars Episode 1: The Phantom Menace
Nicholas Zakas
 
Frontend SPOF
Patrick Meenan
 
do u webview?
Steve Souders
 
Your Script Just Killed My Site
Steve Souders
 
Web Directions South - Even Faster Web Sites
Steve Souders
 
High Performance JavaScript (CapitolJS 2011)
Nicholas Zakas
 
High Performance Snippets
Steve Souders
 
Progressive Enhancement 2.0 (Conference Agnostic)
Nicholas Zakas
 
Metrics of Joy
Steve Souders
 
Cache is King
Steve Souders
 
Oscon 20080724
linkedin_resptest2
 
Preconnect, prefetch, prerender...
MilanAryal
 
Going Node At Netflix
Ryan Anklam
 
Fast Fashion… How Missguided revolutionised their approach to site performanc...
Andy Davies
 
High Performance JavaScript (Amazon DevCon 2011)
Nicholas Zakas
 
Front End Development for Back End Developers - vJUG24 2017
Matt Raible
 
Web20expo 20080425
Media Gorod
 
Web Page Test - Beyond the Basics
Andy Davies
 

Similar to State of the resource timing api (20)

PDF
Make It Fast - Using Modern Browser Performance APIs to Monitor and Improve t...
Nicholas Jansma
 
PDF
Measuring Real User Performance in the Browser
Nicholas Jansma
 
PPTX
Using Modern Browser APIs to Improve the Performance of Your Web Applications
Nicholas Jansma
 
PPTX
Metrics, metrics everywhere (but where the heck do you start?)
Tammy Everts
 
PPTX
Velocity NYC: Metrics, metrics everywhere (but where the heck do you start?)
Cliff Crocker
 
PPTX
Metrics, metrics everywhere (but where the heck do you start?)
SOASTA
 
PDF
Beyond Page Level Metrics
Philip Tellis
 
PDF
Web performance mercadolibre - ECI 2013
Santiago Aimetta
 
PDF
4Developers 2015: People don't give a f**k of JavaScript - Aurelio De Rosa
PROIDEA
 
PPTX
The Truth About Your Web App's Performance
John Riviello
 
PPTX
Measuring Performance in the Browser
Alois Reitbauer
 
PDF
Edge 2014: A Modern Approach to Performance Monitoring
Akamai Technologies
 
PDF
Tool it Up! - Session #2 - NetPanel
toolitup
 
PPTX
Measuring User Experience in the Browser
Alois Reitbauer
 
PPTX
Measuring User Experience
Alois Reitbauer
 
PPTX
Metrics, Metrics Everywhere (but where the heck do you start?)
SOASTA
 
PPTX
Metrics, metrics everywhere (but where the heck do you start?)
Tammy Everts
 
PPTX
Metrics, Metrics Everywhere (but where the heck do you start?)
SOASTA
 
PPTX
The High Performance Web Application Lifecycle
Alois Reitbauer
 
PDF
2014 06-23 velocity sc beyond page metrics
Buddy Brewer
 
Make It Fast - Using Modern Browser Performance APIs to Monitor and Improve t...
Nicholas Jansma
 
Measuring Real User Performance in the Browser
Nicholas Jansma
 
Using Modern Browser APIs to Improve the Performance of Your Web Applications
Nicholas Jansma
 
Metrics, metrics everywhere (but where the heck do you start?)
Tammy Everts
 
Velocity NYC: Metrics, metrics everywhere (but where the heck do you start?)
Cliff Crocker
 
Metrics, metrics everywhere (but where the heck do you start?)
SOASTA
 
Beyond Page Level Metrics
Philip Tellis
 
Web performance mercadolibre - ECI 2013
Santiago Aimetta
 
4Developers 2015: People don't give a f**k of JavaScript - Aurelio De Rosa
PROIDEA
 
The Truth About Your Web App's Performance
John Riviello
 
Measuring Performance in the Browser
Alois Reitbauer
 
Edge 2014: A Modern Approach to Performance Monitoring
Akamai Technologies
 
Tool it Up! - Session #2 - NetPanel
toolitup
 
Measuring User Experience in the Browser
Alois Reitbauer
 
Measuring User Experience
Alois Reitbauer
 
Metrics, Metrics Everywhere (but where the heck do you start?)
SOASTA
 
Metrics, metrics everywhere (but where the heck do you start?)
Tammy Everts
 
Metrics, Metrics Everywhere (but where the heck do you start?)
SOASTA
 
The High Performance Web Application Lifecycle
Alois Reitbauer
 
2014 06-23 velocity sc beyond page metrics
Buddy Brewer
 
Ad

Recently uploaded (20)

PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Ad

State of the resource timing api

  • 1. State of the Resource Timing API Aaron Peters [email protected] WebPerfDays Amsterdam, May 18 2013
  • 2. What is the Resource Timing API? API in the browser that exposes load time data for page resources. "Navigation Timing API for for page objects"
  • 3. How get timing data via the API? window.performance.getEntriesByType("resource")[1] { connectEnd: 298.0000000097789 connectStart: 298.0000000097789 domainLookupEnd: 298.0000000097789 domainLookupStart: 298.0000000097789 duration: 682.9999999608845 entryType: "resource" fetchStart: 298.0000000097789 initiatorType: "css" name: "http://st.cdnplanet.com/static/fonts/amaranth-bold-webfont.woff" redirectEnd: 0 redirectStart: 0 requestStart: 946.9999999962747 responseEnd: 980.9999999706633 responseStart: 962.9999999962747 secureConnectionStart: 0 startTime: 298.0000000097789 }
  • 4. Is the API ready for use? Spec is not final yet. W3C Candidate Recommendation API currently implemented in a few browsers: ● IE10 ● Chrome, Chrome Mobile, Chrome Frame Does it behave constistently & according to the spec?
  • 5. 12 things you should know when using the API
  • 6. When does the API make data available for a resource? While it's loading (OMG!) Bug? Yes, but useful "Did main.css finish loading within 5 seconds?" After the resource has finished loading This is according to spec
  • 7. Timing-Allow-Origin: must be * Spec states: T-A-O must be either origin-list-or-null (RFC 6454) or * In both browsers, only * works. This does not work today: ● host: www.aaronpeters.nl ● scheme + host: http://www.aaronpeters.nl/ ● scheme + host + port: http://www.aaronpeters.nl: 80/
  • 8. Detect browser disk cache hits Yes, you can! if( requestStart == fetchStart && requestStart == responseStart && responseStart != responseEnd ) { // disk cache hit } Note: IE10 Dev Tools shows 304 when actually is a disk cache hit. Yes, you can! if( domainLookupStart != 0 && requestStart == 0 ) { //disk cache hit } Chrome says it's a bug, I say it is a feature
  • 9. Browser memory cache hits? Not exposed by the API: there is no data for the resource This is a bug ??? I have no idea how to test for a memory cache hit in IE10
  • 10. Detect 4xx/5xx responses? Not exposed by the API: there is no data for the resource This is a bug Data available via API Looks same as cross-origin 200 response without valid T-A-O header: all timing attributes equal zero, except startTime, fetchStart, duration and responseEnd
  • 11. domainLookupStart = 0, huh? Sometimes, in Chrome, domainLookupStart = 0, even when a valid Timing-Allow-Header is present. This is always impossible. if(domainLookupStart < fetchStart){ // abort! }
  • 12. DNS lookup & Connect times unavailable in IE10 Values of the 4 relevant attributes are always zero. It's a bug.
  • 13. IE10, y u no show SSL time? sslTime = connectEnd - secureConnectionStart Chrome's behavior is in line with Navigation Timing API behavior, but Resource Timing spec has conflicting info. That will be fixed. Not exposed by the API secureConnectionStart attribute is not present ! Actually, the attribute is optional according to the spec
  • 14. Track 'wait time' How long is a resource in queue, waiting to be fetched? If many resources have high waitTime, there is an optimization opportunity (domain sharding?) if(connectEnd == fetchStart){ waitTime = requestStart - connectEnd } else { waitTime = domainLookupStart - fetchStart }
  • 15. duration is useless Same origin resource || valid T-A-O header Has no added value. What specific insight can be gained from duration? Cross-origin resource No insight in split between 'wait time' and 'load time', so how can duration possibly be informative? duration = responseEnd - startTime
  • 16. Ignore all data in Chrome Frame Data is exposed by the API, but it's bad data. Objects fetched over network 'look' like browser disk cache hits if(!window.externalHost){ // not Chrome Frame }
  • 17. Bytesize is not exposed :( You can't know how many bytes were transferred. A deliberate 'feature', for security reasons. I strongly disagree. Knowing the bytesize is essential for understanding resource load time. Why not make it opt-in to expose bytesize? Let the publisher be in control! This discussion with the Working Group is not finished!
  • 19. Chrome currently uses a vendor prefix, eg. webkitGetEntriesByType("resource") When they switch to Blink, the prefix will be gone Firefox will support the API soon(-ish), likely sans prefix. Low activity on bug 822480 Safari & Opera will likely not have the API anytime soon: they don't even support Navigation Timing API ! Future browser support
  • 20. if one value doesn't make sense, discard all values Be safe
  • 21. Thank you ! Aaron Peters [email protected] WebPerfDays Amsterdam, May 18 2013 www.aaronpeters.nl/blog/state-of-resource-timing-api