Live data from Hacker News

Mathematically optimal markup with HTML5

shinyplasticbag.posterous.com

21–28 of 28 posts

Re: Mathematically optimal markup with HTML5

#21

Earlier quoted context omitted.

Go view the source of Google.com No or tags for one.

A friend of mine worked for Google when that was introduced and said it was purely a rendering speed optimization. Someone did some tests and found the page pops a little faster if you leave out those closing tags. I can't seem to find any articles on it but it seems more reasonable than trying to save a couple bytes, given the other markup that's been mentioned here.

Friend of mine did tests on this and found there is no significant performance difference in either direction. So dropping them is certainly worth it.

Re: Mathematically optimal markup with HTML5

#22
post #8

I suppose some day I'll have to start writing my HTML to be read by machines, rather than humans. Right now I treat it like code: proper indentation, helpful comments, and the occasional hidden message for the reader.

If you write it, then surely you should be able to read it. Then you have a minifier convert it into non-human-readable form, if you like.

Re: Mathematically optimal markup with HTML5

#23
Interestingly, the HTML serialiser in html5lib[1] actually defaults to omitting omittable tags; I wanted a small script like htmltidy that used the HTML5 parsing algorithm, so I hooked up the html5lib parser and serialiser, and wound up with output even more chopped and cryptic than what I put in.

Luckily, setting the include-optional-tags option gave me much more readable output.

[1]: http://code.google.com/p/html5lib/

Re: Mathematically optimal markup with HTML5

#24
post #8

I suppose some day I'll have to start writing my HTML to be read by machines, rather than humans. Right now I treat it like code: proper indentation, helpful comments, and the occasional hidden message for the reader.

  I suppose some day I'll have to start writing my HTML to be 
  read by machines, rather than humans.
I'm curious how you defend the assertion that you write HTML for humans. You write it on a computer, for other computers, with quite a lot of markup that humans are never going to see. For every ten thousand pageloads, how many people do you think are going to hit "view source?" Writing for "other humans" would be something like a document in a WYSIWYG editor, like Word.

The comparison to code is even more hilariously in-apt. A parser or a complier ignores the indentation and commenting when producing the final product.

Re: Mathematically optimal markup with HTML5

#25
post #8

I suppose some day I'll have to start writing my HTML to be read by machines, rather than humans. Right now I treat it like code: proper indentation, helpful comments, and the occasional hidden message for the reader.

I suppose some day I'll have to start writing my HTML to be read by machines, rather than humans. I'm curious how you defend the assertion that you write HTML for humans. You write it on a computer, for other computers, with quite a lot of markup that humans are never going to see. For every ten thousand pageloads, how many people do you think are going to hit "view source?" Writing for "other humans" would be someth…

I write my code and HTML to be read by a human because:

1. I may need to work on that code or page in the future,

2. Someone else may need to work on that page/code,

3. Some of that code may end up as open source,

4. I'm showing off to the 0.01% of people who view the source. I'd like everything I do to be of educational value to someone, somewhere, even if all they learn is how bad I am at writing compact HTML.

If I ever have any high-traffic sites, I'll most likely use a compacting system to shrink properly-indented templates and/or cached output from Ruby on Rails, rather than manually compact the HTML.

Re: Mathematically optimal markup with HTML5

#26
post #22
post #8

I suppose some day I'll have to start writing my HTML to be read by machines, rather than humans. Right now I treat it like code: proper indentation, helpful comments, and the occasional hidden message for the reader.

If you write it, then surely you should be able to read it. Then you have a minifier convert it into non-human-readable form, if you like.

Except he doesn't write it. It's output from a program. Compilers don't emit readable output either.

I'm not saying I'm against clean HTML. But the argument you give is probably invalid.

Re: Mathematically optimal markup with HTML5

#28

Sure, let's just start to omit ending tags from HTML. Who cares about older browsers that will fail to properly render our sites. I'm sure that every business and user keeps their browsers up to date.

Actually, the HTML5 parsing algorithm was derived by reverse engineering the existing browser parsers. It's pretty compatible.
Post reply on HN