gpt4 book ai didi

firefox - 什么是推测解析?

转载 作者:行者123 更新时间:2023-12-04 01:31:33 25 4
gpt4 key购买 nike

我听说 Firefox 3.5 在其 parser 中有一个新功能?

Improvements to the Gecko layout engine, including speculative parsing for faster content rendering.



你能不能简单解释一下。

最佳答案

这一切都与 bugzilla 中的这个条目有关:https://bugzilla.mozilla.org/show_bug.cgi?id=364315

在该条目中,Anders Holbøll 建议:

It seems that when encountering a script-tag, that references an external file, the browser does not attempt to load any elements after the script-tag until the external script files is loaded. This makes sites, that references several or large javascript files, slow.
...
Here file1.js will be loaded first, followed sequentially by file2.js. Then img1.gif, img2.gif and file3.js will be loaded concurrently. When file3.js has loaded completely, img3.gif will be loaded.

One might argue that since the js-files could contain for instance a line like "document.write('<!--');", there is no way of knowing if any of the content following a script-tag will ever be show, before the script has been executed.

But I would assume that it is far more probable that the content would be shown than not. And in these days it is quite common for pages to reference many external javascript files (ajax-libraries, statistics and advertising), which with the current behavior causes the page load to be serialized.



所以本质上,html 解析器继续读取 html 文件并加载引用的链接,即使它由于脚本而被阻止呈现。

之所以称为“推测性”,是因为脚本可能会设置诸如“ display: none”之类的 css 参数或注释掉以下 html 的部分,并且通过这样做,使证书加载变得不必要……但是,在 95% 的用例中,大部分引用将被加载,因此解析器通常会正确猜测。

关于firefox - 什么是推测解析?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1072774/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com