- From: Jonas Sicking <jonas@sicking.cc>
- Date: Sat, 3 Jan 2009 03:31:56 +0100
- To: "Maciej Stachowiak" <mjs@apple.com>
- Cc: "Ian Hickson" <ian@hixie.ch>, "Henri Sivonen" <hsivonen@iki.fi>, "HTMLWG WG" <public-html@w3.org>
On Fri, Jan 2, 2009 at 6:21 PM, Maciej Stachowiak <mjs@apple.com> wrote: > > On Jan 2, 2009, at 5:09 AM, Jonas Sicking wrote: > >> >> I agree that this would complicate a parser implementation that >> doesn't do speculative parsing while blocked for <script>s. However >> the extra complication is very small compared to the complication >> added to speculative parsers. Additionally, it does simplify the >> interface between the parser and the DOM since with this and the other >> change that has been proposed there is no need to read data back from >> the DOM. This interface simplification is likely about the same as >> adding an extra flag to each node in the tag stack. >> >> Also, any competitive browser is going to have to do speculative >> parsing. The performance gains from doing so is so substantial that >> not doing it is not really an option. > > WebKit trunk does speculative parsing but we don't require anything like > this (since we don't care about reusing the tokens - tokenizing is cheap - > and we haven't cared so far about multithreaded parsing). In fact it seems > to me it would make things more complicated if we were required to > distinguish between parser-added and script-added children at parse time. Sorry, I got mixed up regarding why we made this request. Do note though that you don't need to distinguish between parser-added children and script-added children in the node though. All you need to do is add information to the stack of open elements regarding if the parser has added children to the node or not. It's likely that the stack already contains information other than the node itself, such as if the node is a formatting node or not, so adding an extra bit should be no work. There is a small amount of work required to set this extra bit to true though any time the parser adds a child to the node. However this amount of work hardly seems enough to sacrifice the ability to do off-main-thread parsing. / Jonas
Received on Saturday, 3 January 2009 02:32:31 UTC