tags:

views:

41

answers:

1

As per this recent question, HTML 4 standard indicates that closing </TD>/</TR> tags are optional.

The question is, if you write your HTML omitting those closing tags, would that affect the amount of work that the browser's HTML parser must do one way or the other?

I realize that the difference - even if there's any effect - would probably be minuscule and not matter in practice - this question is out of pure theoretical curiosity.

My own thinking is that there will be a modest gain, from having less text to parse, and no loss, since there ought to be a code for parsing an opening tag inside a TD or TR anyway even if their closing tags weren't optional; and therefore the only cost code-wise for making them optional is a check whether an open tag contained in <TD> is another <TD> or <TR> without a previously encountered nested <TABLE>... doesn't seem like a very costly addition.

+1  A: 

I created a bare HTML page with with an insane large table: 100,000 cells spread over 1000 columns and 100 rows, each filled with "x". The XHTML-valid one is about 10MB in size and the HTML-valid one is about 5MB in size. I tested it in 3 runs on FF 3.6.11 and IE8. Browsers are started clean on every run.

FF took on average 2 minutes and 5 seconds for the XHTML valid one and 1 minute and 15 seconds for the HTML valid one.

IE8 took on average 1 minute and 40 seconds for the XHTML valid one and the same time for the HTML valid one. It however ends up with a blank page on all occurrences.

Above results are open for further interpretation. To me, I would worry more about network bandwidth and maintainability than about browser's capabilities. Network bandwidth costs more $$$.

BalusC
interesting observations - especially the blank page in IE! (I wonder what the limit is... is it a DOM node limit? memory limit, or what?)
scunliffe