JavaScript contributes to the increasing complexity of today's web. To support user interactivity and accelerate the development cycle, web developers heavily rely on large general-purpose third-party JavaScript libraries. This practice increases the size and the processing complexity of a web page by bringing additional functions that are not used by the page but unnecessarily downloaded and processed by the browser. In this paper, an analysis of around 40,000 web pages shows that 70% of JavaScript functions on the median page are unused, and the elimination of these functions would contribute to the reduction of the page size by 60%. Motivated by these findings, we propose Muzeel (which means eliminator in Arabic); a solution for eliminating JavaScript functions that are not used in a given web page (commonly referred to as dead code). Muzeel extracts all of the page event listeners upon page load, and emulates user interactions using a bot that triggers each of these events, in order to eliminate the dead code of functions that are not called by any of these events. Our evaluation results spanning several Android mobile phones and browsers show that Muzeel speeds up the page load by around 30% on low-end phones, and by 25% on high-end phones under 3G network. It also reduces the speed index (which is an important user experience metric) by 23% and 21% under the same network on low-end, and high-end phones, respectively. Additionally, Muzeel reduces the overall download size while maintaining the visual content and interactive functionality of the pages.
翻译:JavaScript 帮助了今天网络的日益复杂性。 为了支持用户互动并加速开发周期, 网络开发者严重依赖大型通用第三方 JavaScript 图书馆。 这种做法增加了网页上未使用但浏览器不必要地下载和处理的额外功能, 从而增加了网页的大小和处理复杂性。 本文对约40,000个网页上约40,000个 JavaScript 功能的分析显示, 中位页面上的70% JavaScript 功能没有被使用, 取消这些功能将有助于将页面的长度减少60%。 基于这些发现, 我们建议 Muzeel (意指阿拉伯的缩略音) ; 一种在特定网页上未使用的消除 JavaScript 功能的方法( 通常称为死代码) 。 Muzeel 提取了所有页面上页上的页面听众, 并用一个触发这些事件的机器人来模仿用户互动, 以便消除不为这些事件所要求的任何功能的死代码。 我们的评估结果显示的是, 几个视频内容的缩略数据, 和浏览器上 25 % 的精精精精精精精度在网络上, 通过高精度网络上, 25 G 在23 速度上, 降低了21 速度 。