[webkit-dev] Feature Announcement: Moving HTML Parser off the Main Thread

Eric Seidel eric at webkit.org
Wed Jan 9 18:00:59 PST 2013

We're planning to move parts of the HTML Parser off of the main thread:

This is driven by our testing showing that HTML parsing on mobile is
be slow, and long (causing user-visible delays averaging 10 frames /
Complete data can be found at [1].

Mozilla moved their parser onto a separate thread during their HTML5
parser re-write:

We plan to take a slightly simpler approach, moving only Tokenizing
off of the main thread:
The left is our current design, the middle is a tokenizer-only design,
and the right is more like mozilla's threaded-parser design.

Profiling shows Tokenizing accounts for about 10x the number of
samples as TreeBuilding.  Including Antti's recent testing (.5% vs.
If after we do this we measure and find ourselves still spending a lot
of main-thread time parsing, we'll move the TreeBuilder too. :)  (This
work is a nicely separable sub-set of larger work needed to move the

We welcome your thoughts and comments.

1. https://docs.google.com/spreadsheet/ccc?key=0AlC4tS7Ao1fIdGtJTWlSaUItQ1hYaDFDcWkzeVAxOGc#gid=0
(Epic thanks to Nat Duca for helping us collect that data.)

More information about the webkit-dev mailing list