A Web Developer Tool for Simplifying Mobile Pages Through Javascript Optimizations
Total Page:16
File Type:pdf, Size:1020Kb
JSAnalyzer: A Web Developer Tool for Simplifying Mobile Pages Through JavaScript Optimizations MOUMENA CHAQFEH, New York University Abu Dhabi, UAE JACINTA HU, New York University Abu Dhabi, UAE WALEED HASHMI, New York University Abu Dhabi, UAE RUSSELL COKE, New York University Abu Dhabi, UAE LAKSHMI SUBRAMANIAN, New York University, USA YASIR ZAKI, New York University Abu Dhabi, UAE The amount of JavaScript embedded in Web pages has substantially grown in the past decade, leading to large and complex pages that are computationally intensive for mobile devices. In this paper, we propose JSAnalyzer, an easy-to-use tool that enables Web developers to quickly optimize and generate simpler versions of existing web pages for mobile users. JSAnalyzer can selectively enable or disable JavaScript elements in a page while visually observing their impact, such that non-critical elements can be removed without sacricing the visual content or the interactive functionality. Our quantitative evaluation results show that JSAnalyzer achieves more than 88% relative increase in performance scoring for low-end mobile phones (i.e., from 32% to 60%), and reduces the page load time by 30%. A qualitative study of 22 users shows that JSAnalyzer maintains more than 90% visual similarity to the original pages, whereas a developer evaluation study conducted with 23 developers shows that JSAnalyzer scores more than 80% in terms of usefulness and usability while retaining the page content and functional features. Additionally, we show that JSAnalyzer outperforms state-of-the-art solutions such as JSCleaner and Google AMP. 1 INTRODUCTION Mobile web user experience has become a major concern due to two main reasons: the increasing complexity of the pages, and the processing limitations of mobile devices. The average Page Load Time (PLT) of existing mobile pages is about 19 seconds on a 3G connection and 14 seconds on a 4G connection, while 53% of a mobile page visitors will leave the page if it doesn’t load within three seconds [24]. These numbers suggest that many web developers might be unaware of the performance of their pages on mobile devices. The processing cost of pages is even higher when accessed by low-end mobile devices (with low RAM and CPU), which are popular in developing regions. The total number of mobile web users has recently exceeded 3.5 billion worldwide with 74% of users living in low and middle income countries [15], where smartphones are the primary (and sometimes the sole) means of Internet access [8]. Many of these countries are plagued with poor network infrastructure, where users suer from low data rates and extremely long network delays. While the provision of fast and aordable connectivity worldwide would be the ideal solution to bridge the access and performance gap between the under-served users and the developed world, the current plans in many countries (see example [11]) shows that applying this solution would take years to be achieved. A faster and cheaper alternative is to provide lighter versions of web pages that are less intensive to be processed by mobile browsers. Authors’ addresses: Moumena Chaqfeh, New York University Abu Dhabi, Abu Dhabi, UAE, [email protected]; Jacinta Hu, New York University Abu Dhabi, Abu Dhabi, UAE, [email protected]; Waleed Hashmi, New York University Abu Dhabi, Abu Dhabi, UAE, [email protected]; Russell Coke, New York University Abu Dhabi, Abu Dhabi, UAE, [email protected]; Lakshmi Subramanian, New York University, NY, USA, [email protected]; Yasir Zaki, New York University Abu Dhabi, Abu Dhabi, UAE, [email protected]. 1 When it comes to browser processing, JavaScript (JS) elements used by most modern web pages [30] are proven to be the most expensive compared to other equivalent sized resources [45]. Despite its impact on web pages’ performance, the current status of the World Wide Web shows that mobile pages utilize 20 external JS elements at the 50C⌘ percentile of the number of JS distribution taken over seven million web pages (in comparison to 21 external JS elements for Desktop pages), where a triple processing time can be witnessed on a mobile device compared to a desktop [12]. While best practices show that considering smaller JS bundles is the ideal way to improve the performance of a web page [12], existing developer tools do not consider JS optimizations, but rather focus on other considerations such as: tracking and debugging JS code [29, 34, 40], borrowing functionality from existing pages [49], or reducing the eort to reproduce contents [27]. In this paper, we propose JSAnalyzer to provide a tool for Web developers to rapidly prepare lightweight versions of existing pages, with the objective of improving mobile web access for hundreds of millions of users in developing regions. Since JS may (or may not) be utilized in web pages for visual content generation, and/or interactive functionality provisioning (such as interactive menus), a major challenge that is addressed by JSAnalyzer is the ability to maintain the visual content and functionality of the pages. With JSAnalyzer, each JS element on a web page can be enabled or disabled via an interactive user interface. The eect of the user interactions (enabling/disabling) on the page is visualized in a controlled web browser, which loads a new version of the page according to these interactions upon request—these reloads happen almost instantaneously given the fact that there are being requested from a close-by cache. This aids the developer in making a nal decision on JS preservation or removal based on the visual impact observed on the page. As such, all JS elements that do not sacrice the page content or functionality can be disabled. To aid the user in identifying the functionality of JS elements (especially when they have no visual eect on the page), we integrate a JS classier that attempts to tag each element with an appropriate category. The considered categories are suggested by the experts of the web community [16], which are: Advertising, Analytics, Social, Video, Utilities, Hosting, Marketing, Customer Success, Content, CDN, and Tag Management. These tags aim to assist the developer in making a decision on what to preserve and what to remove. These tags are merely used to give the developer a suggestion about the category behind a certain JS element, however the nal removal decision is left to the developer. By the end of an analysis session, the developer can save and evaluate a simplied version of the page, which preserves all JS elements enabled by the developer, and removes disabled elements. The simplied page is characterized by an improved performance in comparison to the original page, not only in terms of PLT, but also in bandwidth and energy consumption due to the reduction in the download size. With a reduced bandwidth consumption, users can browse more pages using their data plans, while the reduction in consuming energy can increase the life time of mobile battery (since web browsing is a major drain on the battery power) [42]. We evaluated 100 popular pages simplied by JSAnalyzer quantitatively (using a low-end and a high-end mobile phone) and qualitatively (via a qualitative evaluation tool and a user study). In addition, we evaluated JSAnalyzer by recruiting 23 developers with various web development experience. The quantitative evaluation shows an improvement in the overall user experience metrics on low-end phones by more than 88% (from 32% to 60%), and by 38% (from 45% to 62%) on high-end phones. Results also show a reduction in the page load time of around 30%. The qualitative user study of 22 users shows that the simplied pages maintain more than 90% visual similarity to the original pages. JSAnalyzer provides better results in terms of the user experience metrics in comparison to JSCleaner [26] and Google AMP [32]. In contrast to JSCleaner which removes JS elements from web pages based on their features, JSAnalyzer provides an interactive interface via which the developer can qualitatively evaluate the impact of JS removal on the page. With JSAnalyzer, the simplication process happens one step at a time, so that the developer can disable a 2 certain JS element and immediately observe the visual impact of this action. On the other hand, JSCleaner blindly removes non-critical elements all at once, and the user can only observe the nal simplied version. Consequently, the pages simplied using JSAnalyzer show higher similarity scores to the original pages compared to JSCleaner pages. In summary, the contribution of this paper includes: JSAnalyzer, a novel JS analysis environment that works on all web pages to rapidly prepare lighter versions for • mobile web, without sacricing the visual content or the functionality of the original pages. An evaluation of JSAnalyzer pages in terms of performance gains, the overall user experience, and the pages • quality. An evaluation study of JSAnalyzer tool from dierent perspectives depicted by 23 web developers. • 2 RELATED WORK 2.1 JavaScript Tools for Web Developers and Users To the best of our knowledge, current developer tools do not allow for the dynamic generation of lighter versions of web pages from existing original pages, which became a crucial requirement for developers to accommodate the requirements of mobile web users. JSAnalyzer aims to ll the gap in existing developer tools [23, 27, 29, 34, 35, 40, 49] that allow for JS debugging and tracking in web pages, or producing interactive content from existing pages. Chrome Developer Tools are extended in [34] to track and visualize JS method calls and JS libraries, where JS libraries are detected in existing pages and listed to the user with their corresponding versions. In [23] and [39], it is proposed to assist developers in identifying and locating the code that implements interactive features in web pages, while in [35] and [44], a better understanding is provided to discover how JavaScript supports interactivity in web pages.