What is speculative parsing?

前端 未结 2 1775
孤城傲影
孤城傲影 2021-02-05 23:02

I\'ve read that Firefox 3.5 has a new feature in its parser ?

Improvements to the Gecko layout engine, including speculative parsing for faster conten

2条回答
  •  猫巷女王i
    2021-02-05 23:23

    It's all to do with this entry in bugzilla: https://bugzilla.mozilla.org/show_bug.cgi?id=364315

    In that entry, Anders Holbøll suggested:

    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('

    热议问题