From da78a9e329e272dedb2400b79a3bdeebff387d47 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:42:17 -0500 Subject: initial commit --- files/it/web/performance/index.html | 286 +++++++++++++++++++++ .../percorso_critico_di_rendering/index.html | 62 +++++ 2 files changed, 348 insertions(+) create mode 100644 files/it/web/performance/index.html create mode 100644 files/it/web/performance/percorso_critico_di_rendering/index.html (limited to 'files/it/web/performance') diff --git a/files/it/web/performance/index.html b/files/it/web/performance/index.html new file mode 100644 index 0000000000..cbcc4b1da2 --- /dev/null +++ b/files/it/web/performance/index.html @@ -0,0 +1,286 @@ +--- +title: Web Performance +slug: Web/Performance +tags: + - Landing + - NeedsTranslation + - Performance + - TopicStub + - Web Performance +translation_of: Web/Performance +--- +

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 open up, 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 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

+ +

In this section

+ +

{{LandingPageListSubpages}}

+ +
+
+

Selected tutorials

+ +

The MDN Web Performance Learning Area contains modern, up-to-date tutorials covering Performance essentials:

+ +
+
What is web performance
+
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.
+
Web Performance Basics
+
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.
+
How do users perceive performance?
+
+

More important than how fast your website is in milliseconds, is how fast do your users perceive your site to be. Page load time, idling, responsiveness to user interaction, and the smoothness of scrolling and other animations impact these perceptions. 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.

+
+
Multimedia: Images and Video
+
Frequently, media optimization is the lowest hanging fruit of web performance. 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 images, 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 performance features
+
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.
+
+ +
+
+
+ +
+

Using Performance APIs

+ +
+
Performance API
+
This guide describes how to use the Performance interfaces that are defined in the High-Resolution Time standard.
+
Resource Timing API
+
Resource loading and timing the loading of those resources, including managing the resource buffer and coping with CORS
+
The performance timeline
+
The Performance Timeline standard defines extensions to the Performance interface to support client-side latency measurements within applications. Together, these interfaces can be used to help identify an application's performance bottlenecks.
+
User Timing API
+
Create application specific timestamps using the user timing API's "mark" and "measure" entry types - that are part of the browser's performance timeline.
+
Frame Timing API
+
The PerformanceFrameTiming interface provides frame timing data about the browser's event loop.
+
Beacon API
+
The Beacon interface schedules an asynchronous and non-blocking request to a web server.
+
Intersection Observer API
+
Learn to time element visibility with the Intersection Observer API and be asynchronously notified when elements of interest becomes visible.
+
+ +

Other documentation

+ +
+
Developer Tools Performance Features
+
This section provides information on how to use and understand the performance features in your developer tools, including Waterfall, Call Tree, and Flame Charts.
+
Understanding Latency
+
Latency is the amount of time it takes between the browser making a request for a resource, and the browser receiving back the first byte of the resource requested. This article explains what latency is, how it impacts performance, how to measure latency, and how to reduce it.
+
+
+
+ +

Glossary Terms

+ +
+ +
+ +

Documents yet to be written

+ +
+
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 can ensure even complex content is as performant as possible.
+
Mobile performance
+
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.
+
Performance bottlenecks
+
+
Understanding bandwidth
+
+
+
Bandwidth is the amount of data (measured in Mbps or Kbps) that one can send per second. This article explains the role of bandwidth in media-rich internet applications, how you can measure it, and how you can optimize applications to make the best use of available bandwidth.
+
+
+
HTTP/2 and you
+
+

The transport layer—that is, HTTP—is utterly essential to the functioning of the web, and it has only been relatively recently that it has seen a major update in the form of HTTP/2. Out of the box, HTTP/2 provides many performance improvements and advantages over its predecessor, but it also changes the landscape. In this article, you'll learn what HTTP/2 does for you, and how to fine-tune your application to make it do go even further.

+
+
The role of TLS in performance
+
+

TLS—or HTTPS as we tend to call it—is crucial in creating secure and safe user experiences. While hardware has reduced the negative impacts TLS has had on server performance, it still represents a substantial slice of the time we spend waiting for browsers to connect to servers. This article explains the TLS handshake process, and offers some tips for reducing this time, such as OCSP stapling, HSTS preload headers, and the potential role of resource hints in masking TLS latency for third parties.

+
+
Reading performance charts
+
Developer tools provide information on performance, memory, and network requests. Knowing how to read waterfall charts, call trees, traces, flame charts , and allocations in your browser developer tools will help you understand waterfall and flame charts in other performance tools.
+
Analyzing JavaScript bundles
+
No doubt, JavaScript is a big part of modern web development. While you should always strive to reduce the amount of JavaScript you use in your applications, it can be difficult to know where to start. In this guide, we'll show you how to analyze your application's script bundles, so you know what you're using, as well how to detect if your app contains duplicated scripts between bundles.
+
Lazy loading
+
It isn't always necessary to load all of a web applications assets on initial page load. Lazy Loading is defering the loading of assets on a page, such as scripts, images, etc., on a page to a later point in time – when those assets are actually needed.
+
Lazy-loading JavaScript with import()
+
The term "lazy loading" often refers to load deferment techniques for assets not needed at load such as loading below-the-fold imagery only when those images scroll into the view. Now there are native features to load JavaScript! In this guide, we'll talk about the dynamic import() statement, a newer browser feature, that loads a JavaScript module on demand.
+
Controlling resource delivery with resource hints
+
Browsers often know better than we do when it comes to resource prioritization and delivery—but they're far from clairyovant. Native browser features enable us to hint to the browser when it should connect to another server, or preload a resource before the browser knows it ever needs it. When used judiciously, this can make fast experience seem even faster. In this article, we cover native browser features like rel=preconnect, rel=dns-prefetch, rel=prefetch, and rel=preload, and how to use them to your advantage.
+
Performance Budgets
+
Marketing, design, and sales needs, and developer experience, often ad bloat, third-party scripts, and other features that can slow down web performance. To help set priorities, it is helpful to set a performance budget: a set of restrictions to not exceed during the development phase. In this article, we'll discuss creating and sticking to a performance budget. 
+
Web performance checklist
+
A performance checklist of features to consider when developing applications with links to tutorials on how to implement each features, include service workers, diagnosing performance problems, font loading best practices, client hints, creating performant animations, etc.
+
Mobile performance checklist
+
A concise checklist of performance considerations impacting mobile network users on hand-held, battery operated devices.
+
+ +

App Performance

+ +
+
Performance fundamentals
+
A wide overview of Web application performance, what it is, how the browser helps to improve it, and what tools and processes you can use to test and further improve it.
+
Optimizing startup performance
+
Tips and suggestions to help you improve startup performance, both when writing a new app and when porting an app from another platform to the Web.
+
Profiling with the built-in profiler
+
Learn how to profile app performance with Firefox's built-in profiler.
+
CSS and JavaScript animation performance
+
Animations are critical for a pleasurable user experience. This article discusses the performance differences between CSS- and JavaScript-based animations. 
+
+ +

View all articles about performance...

+ +

See also

+ +

HTML

+ + + +

CSS

+ + + +

JavaScript

+ + + +

APIs

+ + + +

Headers

+ + + +

Tools

+ + + +

Additional Metrics

+ + + +

Best Practices

+ + diff --git a/files/it/web/performance/percorso_critico_di_rendering/index.html b/files/it/web/performance/percorso_critico_di_rendering/index.html new file mode 100644 index 0000000000..31c0b82ac8 --- /dev/null +++ b/files/it/web/performance/percorso_critico_di_rendering/index.html @@ -0,0 +1,62 @@ +--- +title: Percorso critico di rendering +slug: Web/Performance/Percorso_critico_di_rendering +translation_of: Web/Performance/Critical_rendering_path +--- +

{{draft}}

+ +

Il Percorso Critico di Rendering (in inglese: Critical Rendering Path, CRP) è la sequenza di passi che il browser compie per convertire HTML, CSS e Javascript in pixel sullo schermo. Ottimizzare il CRP migliora la performance. Il percorso include ilDocument Object Model (DOM), il CSS Object Model (CSSOM), l'albero di rendering e il layout.

+ +

Il DOM è creato man mano che l'HTML viene parsificato. L'HTML può richiedere Javascript, il quale potrebbe a sua volte alterare il DOM. L'HTML include o richiede fogli di stile, la cui parsificazione costruisce il CSSOM. Il motore del browser combina il DOM e il CSSOM per costruire l'albero di rendering. La fase di layout determina le dimensioni e posizione di ogni elemento della pagine. Infine, i pixel sono dipinti sullo schermo.

+ +

Ottimizzare il CRP migliora il tempo che il browser impiega ad effettuare il primo render. Capire e ottimizzare il percorso critico di rendering è importante per assicurarsi che i reflow e repaint vengano effettuato a 60 frame al secondo, risultando in una migliore esperienza per l'utente.

+ +

Capire il CRP

+ +

La performance di un sito web dipende dal tempo impiegato per effettuare richieste al server, risposte, caricare risorse, eseguire script, rendering, layout, e dipingere i pixel sullo schermo.

+ +

Una richiesta per una pagina web o una web app inizia con una richiesta HTML. Il server risponde alla richiesta con il codice sorgente in linguaggio HTML. A questo punto, il browser inizia a parsificare l'HTML, costrudendo l'albero DOM.

+ +

Il browser manda ulteriori richieste ogni volta che trova link a risorse esterne, che siano fogli di stile, script, o referenze a immagini. Alcune richieste sono bloccanti, il che significa che la parsificazione del resto dell'HTML viene interrotta fino a quando la risorsa importata non viene scaricata e manipolata. In seguito, il browser continua a parsificare l'HTML fino ad arrivare alla fine del file. A questo punto, il browser comincia a costruire il CSSOM. Quando il DOM e il CSSOM sono completi, il browser costruisce l'albero di rendering, calcolando gli stili per tutto il contenuto visibile. Quando l'albero è completo, viene calcolato il layout, che definisce le dimensioni e posizione di tutti gli elementi dell'albero di rendering. Una volta completato, la pagina viene "dipinta" sullo schermo.

+ +

Document Object Model

+ +

La costruzione del DOM è incrementale. La risposta HTML si transforma in token, la quale si trasforma in nodi che costituiscono l'albero DOM. Un singolo nodo DOM comincia con un token startTag e finisce con un token endTag. I nodi contengono tutte le informazioni rilevanti sull'elemento HTML, descritta attraversi i token. I nodi sono connessi in un albero DOM in base alla gerarchia dei token. Per esempio, se un paio di token startTag ed endTag appaiono nel mezzo di un altro paio, questo genera un nodo padre ed un nodo figlio.

+ +

Un grande numero di nodi può dunque impattare la performance, complicando il critical rendering path.

+ +

CSS Object Model

+ +

Il DOM contiene l'intero contenuto della pagina. il CSSOM contiene tutti gli stili. La costruzione del DOM è incrementale, ma quella del CSSOM non lo è. Il CSS è render-blocking: il browser blocca il rendering di una pagina finché non riceve e processa tutto il CSS. Questo perché le regole possono essere sovrascritte, quindi il contenuto non può essere mostrato fino a quando il CSS non è completo. 

+ +

Il CSS ha le proprie regole per identificare token validi. Quando il parser converte i token in nodi, i nodi discendenti ereditano regole dai genitori. Il CSSOM viene costruito mentre il CSS viene parsificato, ma non può essere usato per costruire il render tree fino a quando la parsificazione viene completata perché stili che vengono sovrascritti in seguito non devono essere visualizzati.

+ +

Selettori meno specifici sono più performanti. Per esempio, .foo {} è più veloce di .bar .foo {} perché quando il browser trova .foo, nel secondo scenario, deve salire nel DOM per controllare se .foo ha un genitore .bar.

+ +

I browser processano il CSS molto rapidamente. La regola specifica è più lenta perché deve attraversare più nodi nell'albero DOM, ma questo costo aggiuntivo è solitamente minimo. L'ottimizzazione dei selettori CSS solitamente porta a velocizzazioni nell'ordine dei microsecondi. Ci sono altri modi più efficaci per ottimizzare il CSS, come la mininizzazione, e separare il CSS in richieste non-blocking usando media queries.

+ +

L'albero di rendering

+ +

L'albero di rendering cattura sia il contenuto che gli stili combinando il DOM ed il CSSOM. Per costruirlo, il browser controlla ogni nodo, a partire dalla radice dell'albero DOM, e determina quali regole CSS sono applicate al nodo.

+ +

L'albero di rendering mantiene informazioni solo su elementi visibili. La sezione head solitamente non contiene informazioni visibili, e quindi non è inclusa. Se display: none; è settato su un elemento, né questo elemento né i suoi discendenti sono inclusi.

+ +

Layout

+ +

Quando l'albero di rendering è completamente costruito, il layout diventa possibile. Il layout dipende dalle dimensioni dello schermo e determina dove e come gli elementi sono posizionati nella pagina, inclusi largezza ed altezza di ogni elemento, e dove sono posizionati rispetto ad altri elementi.

+ +

Elementi block-level hanno una largezza in default di 100% del genitore. L'elemento body ha una larghezza dal 100% del viewport.

+ +

Il meta tag "viewport" definisce la larghezza del viewport. In assenza di questo tag, il browser usa la larghezza viewport di default, che su browser a tutto schermo è solitamente 960px. Su browser a tutto schermo, come il browser degli smartphone, il settaggio <meta name="viewport" content="width=device-width"> fa in modo che la larghezza sarà quella del dispositivo invece di quella di default. La device-width cambia quando l'utente ruota il telefono tra modalità landscape e ritratto. Il layout viene calcolato ogni volta che un dispositivo viene ruotato o il browser viene in qualche modo ridimensionato.

+ +

La performance della fase di layout è impattato dal numero di nodi nel DOM. La fase di layout può diventare un collo di bottiglia se richiesto durante lo scorrimento del mouse o altre animazioni. Un ritardo di 20ms al caricamento della pagina o al cambiamento di orientamento è accettabile, ma potrebbe portare a problemi se avviene durante lo scorrimento del mouse o durante animazioni. Ogni volta che l'albero di rendering è modificato, il passo di layout viene eseguito.

+ +

Per ridurre la frequenza e durate degli eventi di layout, è consigliabile effettuare un batch degli aggiornamenti ed evitare di animare proprietà del box model.

+ +

Paint

+ +

L'ultimo passo è mostrare i pixel sullo schermo. Questo può avvenire quando l'albero di rendering è creato e il layout calcolato. L'intero schermo è dipinto quando la pagina viene caricata. Successivamente, solo le parti dello schermo interessate verranno ridipinte grazie alle ottimizzazioni dei browser moderni. Il tempo necessario a un repaint è solitamente molto veloce, ma è importante ricordarsi di conteggiare il tempo di layout e ripittura quando si misura il tempo richiesto da un animation frame.

+ +

Optimizing for CRP

+ +

Improve page load speed by prioritizing which resources get loaded, controlling the order in which they area loaded, and reducing the file sizes of those resources. Performance tips include 1) minimizing the number of critical resources by deferring their download, marking them as async, or eliminating them altogether, 2) optimizing the number of requests required along with the file size of each request, and 3) optimizing the order in which critical resources are loaded by prioritizing the downloading critical assets, shorten the critical path length.

-- cgit v1.2.3-54-g00ecf