Chapter 5. Performance APIs

The W3C has a Web Performance Working Group that decides what new APIs browsers might implement to help us measure and improve web performance. In this chapter, we will cover the APIs this group has defined as well as other web APIs that will be useful for us in our performance optimization work.

We will look first at the APIs that are available today on some or all browsers, such as the Navigation Timing and Network Information APIs, and then a list of future specs that will help us with performance optimization in the future, such as Script Timing and Efficient Script Yielding.

Measurement APIs

We will start with APIs that will help us during the measurement phase, so we can gather real data from our users.

Navigation Timing

The Navigation Timing API was the first browser API with web performance as its focus. It provides a series of timestamps from the initial page loading process through window.performance. It’s currently available in most modern mobile browsers, including Google Chrome, IE, Edge, Firefox, and Safari from iOS 9. It’s not available in Android Browser or proxy-based browsers.


Some reports claim that Safari has supported the Navigation Timing API since version 8. It was available in that version, but support was quickly removed in release 8.1 a few weeks later due to “performance issues,” as Apple stated at the time. It was fully re-enabled in iOS 9 in 2015.

The global performance object also acts as the home for other performance-based ...

Get High Performance Mobile Web now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.