JavaScript Dead Code Identification, Elimination, and Empirical Assessment

08/31/2023
by   Ivano Malavolta, et al.
0

Web apps are built by using a combination of HTML, CSS, and JavaScript. While building modern web apps, it is common practice to make use of third-party libraries and frameworks, as to improve developers' productivity and code quality. Alongside these benefits, the adoption of such libraries results in the introduction of JavaScript dead code, i.e., code implementing unused functionalities. The costs for downloading and parsing dead code can negatively contribute to the loading time and resource usage of web apps. The goal of our study is two-fold. First, we present Lacuna, an approach for automatically detecting and eliminating JavaScript dead code from web apps. The proposed approach supports both static and dynamic analyses, it is extensible and can be applied to any JavaScript code base, without imposing constraints on the coding style or on the use of specific JavaScript constructs. Secondly, by leveraging Lacuna we conduct an experiment to empirically evaluate the run-time overhead of JavaScript dead code in terms of energy consumption, performance, network usage, and resource usage in the context of mobile web apps. We applied Lacuna four times on 30 mobile web apps independently developed by third-party developers, each time eliminating dead code according to a different optimization level provided by Lacuna. Afterward, each different version of the web app is executed on an Android device, while collecting measures to assess the potential run-time overhead caused by dead code. Experimental results, among others, highlight that the removal of JavaScript dead code has a positive impact on the loading time of mobile web apps, while significantly reducing the number of bytes transferred over the network.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/01/2020

Web APIs in Android through the Lens of Security

Web communication has become an indispensable characteristic of mobile a...
research
12/31/2020

PHP code smells in web apps: survival and anomalies

Context: Code smells are considered symptoms of poor design, leading to ...
research
08/31/2023

Native vs Web Apps: Comparing the Energy Consumption and Performance of Android Apps and their Web Counterparts

Context. Many Internet content platforms, such as Spotify and YouTube, p...
research
07/05/2022

iLibScope: Reliable Third-Party Library Detection for iOS Mobile Apps

Vetting security impacts introduced by third-party libraries in iOS apps...
research
07/24/2023

A Dataset of Android Libraries

Android app developers extensively employ code reuse, integrating many t...
research
11/30/2017

Automating Release of Deep Link APIs for Android Applications

Unlike the Web where each web page has a global URL to reach, a specific...
research
08/31/2020

A3Ident: A Two-phased Approach to Identify the Leading Authors of Android Apps

Authorship identification is the process of identifying and classifying ...

Please sign up or login with your details

Forgot password? Click here to reset