Hacker News new | ask | show | jobs
by jamesbiv 2388 days ago
Though I agree with the sentiment of the article, I believe AMP can easily be thwarted by efficient website structuring and use of libraries with mobile efficiency in mind. What is good about the AMP indexing process is that, I think, Google still favors the non-AMP version of the site if the AMP site is less efficient than the standard version.

Some time back I built a library called DSOlib (https://github.com/jamesbiv/device-streaming-object-library) which deals with this problem particularly. The aim of DSO was to ping the server using Resource Timing (https://www.w3.org/TR/resource-timing/#resource-timing) in-order to determine if the link speed is under a certain threshold.

Should the threshold not be met, then a reduced, non-interactive version of the site loads using the same HTML, as non critical HTML can be moved into templates if needed, and the "Critical Rendering Path" is used to form a decision on how the site should download the sites' elements using DSO. Since images, CSS and JavasSript make up the bulk of the download footprint.

DSO aims at optimising the footprint via the following concepts.

- Offering only the CSS files relevant for breakpoints just for that device;

- Scaling down images and lazy loading them at the lowest possible resolution;

- Blocking out elements of HTML using "display: none" for areas that wont be loaded; and

- Most importantly, only download the minimum Javascript libraries for non interactive viewing.

There are other features DSO has such as background downloading for full interactive after non-interactive has loaded; prompting the user and asking if the interactive version is to be downloaded later, and a few other things. However, I haven't completed the entire project as I was side tracked with other projects but building a solution such as this that works along side WebPack would be the best senario.

Further, I'm not too sure if there are other solutions out there similar to DSO since I stopped development, but surely sidestepping AMP should be a rather straightforward process.