[whatwg] [WebWorkers] Advocation to provide the DOM API to the workers

David Bruant bruant at enseirb-matmeca.fr
Thu Nov 12 18:21:20 PST 2009


Hi,

I was waiting for Firefox to stop freezing on the HTML5 spec page (it
freezes about one minute each time I visit the one-page version) and I
tried to think of a way to "design" this page in a way that wouldn't
freeze my browser.
One good way I have found would be to cut the whole page into several
parts (one the server side, what is already done in the multi-page
version) and to launch several workers. Each worker gets one part of the
whole page in the background and could give it to the browsing context
which will append the right part at the right place.

But what is this "give" ? Without the DOM API, this "give" means
"sending a string through the postMessage() method" and the "append"
means "rightPlace.innerHTML = stringContainingAPartOfThePage".
However, with the DOM API, each worker could build independantly its
documentFragment, send it to the browsing context which will "append"
(appendChild) it in the right place.

Building the page requires 3 main operations :
- getting the content (can be parallelized with the workers which can
make XMLHttpRequests)
- building a DOM tree from the content
- rendering (cannot be parallelized because must occur in the browsing
context)

Without the DOM API, the second step cannot be parallelized in the
WebWorkers.

I understand that the whole DOM API is not useful for the WebWorkers,
but, could a reduced API (sufficient to describe the tree structure of a
document) be available to the web workers to have a chance to
parallelize the tree structuration of the content (and then reduce its
cost) ?

Thanks,

David



More information about the whatwg mailing list