3 ms·
I tried to look at an example AMP page here [1]. When loading with an empty cache, it loads 5.5 Mb of files. I don't see where are the optimizations. It uses a
by codedokode 8y ago
I tried to look at an example AMP page here [1]. When loading with an empty cache, it loads 5.5 Mb of files. I don't see where are the optimizations.
It uses a custom font. Custom fonts are absolutely unnesessary for a news page; they only delay the moment when text becomes visible. Standard Windows fonts are of a good quality and don't need a replacement (which often renders very poorly on Windows XP).
It uses a lot of scripts. Script block some browsers while parsing and executing.
It has SVG images embedded into the page. If you want the page to load faster, you should move images into external files.
AMP is directly linked to Google and cannot be used without it. Please look at the requirements for AMP HTML documents: [2]
> AMP HTML documents MUST ... contain a <script async src="https://cdn.ampproject.org/v0.js"></script> https://cdn.ampproject.org/v0.js"></script> tag inside their head tag.
So every AMP document MUST load a Google-controlled script. And by the way, it contains 12 000 lines when beautified. It contains different Google URLs like 'https://ampcid.google.com/v1/publisher:getClientId?key=' https://ampcid.google.com/v1/publisher:getClientId?key=' or 'https://ampcid.google.com/v1/cache:getClientId?key=AIzaSyDKtqGxnoeIqVM33Uf7hRSa3GJxuzR7mLc' https://ampcid.google.com/v1/cache:getClientId?key=AIzaSyDKt... , references to Doubleclick and AdSense (but not other ad networks). Does every site need it?
It contains a lot of code not necessary for most websites. For example, a XHR interceptor for "some trusted AMP viewers" [3] is included into the script. Or a cryptographic library for calculating sha hashes [4].
You can use only JS components approved by Google; the spec says:
> Extended components
> The script URL must start with https://cdn.ampproject.org https://cdn.ampproject.org
So for example, Google might make a custom component for Facebook but not for QQ or Mixi. Google defines what widget can appear on an AMP page. If you are an ad network, you have to make negotiations with Google to be added (you have to negotiate with your competitor). If US government imposes sanctions on some foreign site, Google will have to comply.
It is clearly a technology made for integrating news articles into a Google page (and judging by limitations in the spec, Google might plan to make a non-vebview native renderer for AMP pages). Don't believe when they try to pretend that it can be used independently as a standard or made for accelerating the web.
[1] https://amp.theguardian.com/us-news/commentisfree/2016/feb/16/thomas-piketty-bernie-sanders-us-election-2016 https://amp.theguardian.com/us-news/commentisfree/2016/feb/1...
[2] https://www.ampproject.org/docs/fundamentals/spec https://www.ampproject.org/docs/fundamentals/spec
[3] https://github.com/ampproject/amphtml/issues/11294 https://github.com/ampproject/amphtml/issues/11294
[4] https://github.com/ampproject/amphtml/blob/master/src/service/crypto-impl.js https://github.com/ampproject/amphtml/blob/master/src/servic...