[html5] Incremental rendering of XHTML5

Jesper Tverskov jesper at tverskov.dk
Thu Aug 11 05:18:37 PDT 2011


Incremental rendering of XHTML5

All major browsers, IE9, Firefox, Safari, Opera, Chrome, today use
incremental rendering also for XML webpages like XHTML5 served with
"application/xhtml+xml". Both for XHTML5 and HTML5 the first "screen"
of a webpage is ready for consumption so fast, that size of the file
hardly seems too matter anymore!

If in doubt, test this mega size webpage of 10,000 lines. I use
polyglot XHTML5 served with "application/xhtml+xml" to the browsers
understanding it. In the last line of the file I have made a
well-formedness error. All major browsers show the first screen of the
webpage almost instantly. After a while, a few seconds, the parsing
reach the wellfomedness error and show an XML error message instead of
the webpage.

http://www.xmlplease.com/parsing/test/

IE9 is a little too creative! If you use mimetype
"application/xhtml+xml" it uses the XML parser but switches to HTML
parsing if it finds a wellformedness error!

Here are two tests of the same file rendered as XML (if you have a new
browser) and HTML, if you want to compare the rendering speed of the
first screen. In my naked eye it looks the same.

XHTML5
http://www.xmlplease.com/parsing/test1a/

HTML5
http://www.xmlplease.com/parsing/test1b/

Here are my questions. What is known about the difference in speed
between XML parsing and HTML parsing of webpages?

1.	In theory an XML parser ought to be faster, being less complex than
an HTML parser.

2.	If an HTML5 page is optimized for small size avoiding end tags for
"p" elements, etc., it probably has a marginal speed advantage that
might make up for the slower parsing?

3.	It could also be true that you get the fastest HTML parsing if the
markup is as well-formed as possible?

4.	Since we have extremely fast incremental rendering both for XHTML5
and HTML5, file size doesn't matter much in a modern browser?

Cheers
Jesper Tverskov
http://www.xmlplease.com



More information about the Help mailing list