From 68fc8e96a9629e73469ed457abd955e548ec670c Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 14:49:58 +0100 Subject: unslug pt-br: move --- .../pt-br/glossary/speculative_parsing/index.html | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 files/pt-br/glossary/speculative_parsing/index.html (limited to 'files/pt-br/glossary/speculative_parsing/index.html') diff --git a/files/pt-br/glossary/speculative_parsing/index.html b/files/pt-br/glossary/speculative_parsing/index.html new file mode 100644 index 0000000000..5da1c3efa2 --- /dev/null +++ b/files/pt-br/glossary/speculative_parsing/index.html @@ -0,0 +1,23 @@ +--- +title: Optimizing your pages for speculative parsing +slug: Web/HTML/Optimizing_your_pages_for_speculative_parsing +translation_of: Glossary/speculative_parsing +--- +

Traditionally in browsers the HTML parser has run on the main thread and has blocked after a </script> tag until the script has been retrieved from the network and executed. The HTML parser in Firefox 4 and later supports speculative parsing off the main thread. It parses ahead while scripts are being downloaded and executed. As in Firefox 3.5 and 3.6, the HTML parser starts speculative loads for scripts, style sheets and images it finds ahead in the stream. However, in Firefox 4 and later the HTML parser also runs the HTML tree construction algorithm speculatively. The upside is that when a speculation succeeds, there's no need to reparse the part of the incoming file that was already scanned for scripts, style sheets and images. The downside is that there's more work lost when the speculation fails.

+

This document helps you avoid the kind of things that make speculation fail and slow down the loading of your page.

+

Making speculative loads succeed

+

There's only one rule for making speculative loads of linked scripts, style sheets and images succeed:

+ +

Avoiding losing tree builder output

+

Speculative tree building fails when document.write() changes the tree builder state such that the speculative state after the </script> tag no longer holds when all the content inserted by document.write() has been parsed. However, only unusual uses of document.write() cause trouble. Here are the things to avoid:

+ -- cgit v1.2.3-54-g00ecf