ISISTAN   23985
INSTITUTO SUPERIOR DE INGENIERIA DEL SOFTWARE
Unidad Ejecutora - UE
congresos y reuniones científicas
Título:
Slimming JavaScript applications: Predicting the minimum Code required by a User
Autor/es:
HERNÁN CEFERINO VÁZQUEZ
Lugar:
Buenos Aires
Reunión:
Otro; Machine Learning Summer School 2018; 2018
Institución organizadora:
MLSS - Universidad Torcuato Di tella
Resumen:
Most websites rely on large and complex JavaScript libraries and frameworks. In front-end JavaScript applications, a common practice is to ship and deploy the JavaScript code as a large file (or bundle), which is the result of combining the application code along with the code of all the libraries on which that application depends. Despite the benefits of having a single bundle per application, this approach leads to applications being shipped with significant portions of code that are actually not used by users. Moreover, not all users make the same use of the site, so different users may need different portions of the code in the bundle. These facts unnecessarily inflate the JavaScript bundles and could slow down website performance because of the extra unused code.In this context, we define the notion of Minimum JavaScript Code Required by User (MJCRU) to denote the minimum JavaScript code that a particular user needs at runtime. Furthermore, we propose a machine learning approach that creates bundles that comply with MJCRU for different kind of users. Thus, reducing the downloading time of webpages. The approach is based on the analysis of the interaction of users with the JavaScript functionality of webpages. The approach has three steps: i) collecting JavaScript usage data; ii) clustering the users based on their profiles features (device type, browser version, among other features); iii) predicting, based on the user profile, which parts of the JavaScript code will be needed. In this way, a JavaScript content server could use the predictive algorithm to reduce the size of JavaScript files to a MJCRU. If some of the reduced parts of the code are needed, they are loaded lazily at runtime to avoid errors.An initial study performed over 22 JavaScript applications, have shown evidence that our approach can produce size reductions of 26% on average (with reductions going up to 66% in some applications).