Refactor #14117
openJavascript should be loaded async, prevents painting being blocked to reduce load times
Description
Problem
Currently, we have a bunch of javascript_include_tag, and other script tags that are not crucial for loading the page, but they block loading and rendering the page. This means the user won't see anything until our big blob of js application.js has been downloaded and ran.
Solution
To solve this, we can just mark all JS tags and script tags as async. This alone would bring 'time to paint' down severely, up to 50%. We would need to tweak some elements to load only when the associated JS has loaded, and handle dependencies between JS files properly. I graphed time to render for multiple configurations.
Currently /hosts renders at about 1000s -
http://i.imgur.com/cyEiQrR.png
Async loading of all JS files in 1 file, /hosts renders in about 500ms -
http://i.imgur.com/gSimgiE.png