Path: blob/main/files/en-us/web/performance/index.md
6532 views
------{{QuickLinksWithSubPages}}
Web performance is the objective measurements and the perceived user experience of load time and runtime. Web performance is how long a site takes to load, become interactive and responsive, and how smooth the content is during user interactions - is the scrolling smooth? are buttons clickable? Are pop-ups quick to load and display, and do they animate smoothly as they do so? Web performance includes both objective measurements like time to load, frames per second, and time to become interactive, and subjective experiences of how long it felt like it took the content to load.
The longer it takes for a site to respond, the more users will abandon the site. It is important to minimize the loading and response times and add additional features to conceal latency by making the experience as available and interactive as possible, as soon as possible, while asynchronously loading in the longer tail parts of the experience.
There are tools, APIs, and best practices that help us measure and improve web performance. We cover them in this section:
Key performance guides
{{LandingPageListSubpages}}
Beginner's tutorials
The MDN Web Performance Learning Area contains modern, up-to-date tutorials covering Performance essentials. Start here if you are a newcomer to performance:
Web performance: brief overview
: Overview of the web performance learning path. Start your journey here.
: This article starts the module off with a good look at what performance actually is — this includes the tools, metrics, APIs, networks, and groups of people we need to consider when thinking about performance, and how we can make performance part of our web development workflow.
How do users perceive performance?
: More important than how fast your website is in milliseconds, is how fast your users perceive your site to be. These perceptions are impacted by actual page load time, idling, responsiveness to user interaction, and the smoothness of scrolling and other animations. In this article, we discuss the various loading metrics, animation, and responsiveness metrics, along with best practices to improve user perception, if not the actual timings.
: In addition to the front end components of HTML, CSS, JavaScript, and media files, there are features that can make applications slower and features that can make applications subjectively and objectively faster. There are many APIs, developer tools, best practices, and bad practices relating to web performance. Here we'll introduce many of these features ad the basic level and provide links to deeper dives to improve performance for each topic.
: Some attributes and the source order of your markup can impact the performance or your website. By minimizing the number of DOM nodes, making sure the best order and attributes are used for including content such as styles, scripts, media, and third-party scripts, you can drastically improve the user experience. This article looks in detail at how HTML can be used to ensure maximum performance.
: The lowest hanging fruit of web performance is often media optimization. Serving different media files based on each user agent's capability, size, and pixel density is possible. Additional tips like removing audio tracks from background videos can improve performance even further. In this article we discuss the impact video, audio, and image content has on performance, and the methods to ensure that impact is as minimal as possible.
: CSS may be a less important optimization focus for improved performance, but there are some CSS features that impact performance more than others. In this article we look at some CSS properties that impact performance and suggested ways of handling styles to ensure performance is not negatively impacted.
JavaScript performance best practices
: JavaScript, when used properly, can allow for interactive and immersive web experiences — or it can significantly harm download time, render time, in-app performance, battery life, and user experience. This article outlines some JavaScript best practices that should be considered to ensure even complex content is as performant as possible.
: With web access on mobile devices being so popular, and all mobile platforms having fully-fledged web browsers, but possibly limited bandwidth, CPU and battery life, it is important to consider the performance of your web content on these platforms. This article looks at mobile-specific performance considerations.
Using Performance APIs
: This guide describes how to use the
Performanceinterfaces that are defined in the High-Resolution Time standard.
: Resource loading and timing the loading of those resources, including managing the resource buffer and coping with CORS
: The Performance Timeline standard defines extensions to the
Performanceinterface to support client-side latency measurements within applications. Together, these interfaces can be used to help identify an application's performance bottlenecks.
: Create application specific timestamps using the user timing API's "mark" and "measure" entry types - that are part of the browser's performance timeline.
: The Beacon interface schedules an asynchronous and non-blocking request to a web server.
: Learn to time element visibility with the Intersection Observer API and be asynchronously notified when elements of interest becomes visible.
Other documentation
Firefox Profiler Performance Features
: This website provides information on how to use and understand the performance features in your developer tools, including Call Tree, Flame Graph, Stack Chart, Marker Chart and Network Chart.
Profiling with the built-in profiler
: Learn how to profile app performance with Firefox's built-in profiler.
Glossary Terms
{{glossary('Beacon')}}
{{glossary('Brotli compression')}}
{{glossary('Code splitting')}}
{{glossary('CSSOM')}}
{{glossary('Domain sharding')}}
{{glossary('Effective connection type')}}
{{glossary('First contentful paint')}}
{{glossary('First CPU idle')}}
{{glossary('First input delay')}}
{{glossary('First interactive')}}
{{glossary('First meaningful paint')}}
{{glossary('First paint')}}
{{glossary('HTTP')}}
{{glossary('HTTP_2', 'HTTP/2')}}
{{glossary('Jank')}}
{{glossary('Latency')}}
{{glossary('Lazy load')}}
{{glossary('Long task')}}
{{glossary('Lossless compression')}}
{{glossary('Lossy compression')}}
{{glossary('Main thread')}}
{{glossary('Minification')}}
{{glossary('Network throttling')}}
{{glossary('Packet')}}
{{glossary('Page load time')}}
{{glossary('Page prediction')}}
{{glossary('Parse')}}
{{glossary('Perceived performance')}}
{{glossary('Prefetch')}}
{{glossary('Prerender')}}
{{glossary('QUIC')}}
{{glossary('RAIL')}}
{{glossary('Real User Monitoring')}}
{{glossary('Resource Timing')}}
{{glossary('Round Trip Time (RTT)')}}
{{glossary('Server Timing')}}
{{glossary('Speculative parsing')}}
{{glossary('Speed index')}}
{{glossary('SSL')}}
{{glossary('Synthetic monitoring')}}
{{glossary('TCP handshake')}}
{{glossary('TCP slow start')}}
{{glossary('Time to first byte')}}
{{glossary('Time to interactive')}}
{{glossary('TLS')}}
{{glossary('TCP', 'Transmission Control Protocol (TCP)')}}
{{glossary('Tree shaking')}}
{{glossary('Web performance')}}
See also
HTML
CSS
GPU v CPU
Measuring layout
Font-loading best practices
JavaScript
APIs
Resource Hints - dns-prefetch, preconnect, prefetch, and prerender
Headers
HTTP/2
Client Hints
Tools
Additional Metrics
Speed Index and Perceptual Speed Index
Best Practices
Content Delivery Networks (CDN)