Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's a good analogy (as long as you mean "HTML" as a banner term to include the HTML spec and associated specs like CSS and Custom Elements [1]).

• AMP is a subset of HTML.

• Any normal HTML engine can, therefore, render any AMP file, without needing to know about the AMP spec.

• It's also possible to make an engine that specialises in rendering AMP (either exclusively, or by switching to a faster mode when it detects the file is just AMP).

• Even in normal HTML engines, AMP files will generally be fast because they avoid 'slow' parts of HTML.

The above points all hold true if you switch the terms to JavaScript and asm.js.

Where the analogy falls short:

• It's easy to write AMP by hand, but asm.js is really only meant to be generated by a compiler.

• Obviously, what is meant by 'fast' is very different in each case. In HTML:AMP, it's about things like reducing network usage, and avoiding layout thrashing by requiring up-front declarations of image dimensions, etc. In JS:asm.js, it's about making compiler optimisations possible so code can execute faster.

Note: AMP does create extra elements, like `<amp-img>`, but these are legit uses of the Custom Elements spec. You can see these elements rendering correctly in Chrome. [2]

[1] http://w3c.github.io/webcomponents/spec/custom/ [2] https://www.ampproject.org/how-it-works/



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: