News for hackers. Stuff that matters.
Re:Managing Async Dependencies with JavaScript by robocat on Saturday May 20, 2017 @12:40PM (#14383164)
For mobile, my timings showed fetch/XHR to be heaps laggier than <script> tags. This matters for any resources on the critical path for rendering your page.

I naively thought that it would be quicker to have an inline <script> (coming first in the <head>) and have the script request JavaScript resources via XHR (to manage resource dependencies and load failures).

However, the browser decides the priority for resource requests and CPU usage. I found that XHR requests got low priority and wouldn't even get requested until after painting delays.

Re:Managing Async Dependencies with JavaScript by jhabdas on Sunday May 21, 2017 @09:06AM (#14387112)
WRT performance, fetch is a newer standard and still getting ironed out. Browsers have been using external scripts for years and know how to handle them efficiently. A downside to using `script` tags however, is they have to be on the page when the document is loaded, and they block the browser run loop.