Remove RATs from Your Code: Automated Optimization of Resource Inefficient Database Writes for Mobile Applications
Developers strive to build feature-filled apps that are responsive and consume as few resources as possible. Most of these apps make use of local databases to store and access data locally. Prior work has found that local database services have become one of the major drivers of a mobile device’s resource consumption. In this paper we propose an approach to reduce the energy consumption and improve runtime performance of database operations in Android apps by optimizing inefficient database writes. Our approach automatically detects database writes that happen within loops and that will trigger inefficient autocommit behaviors. Our approach then uses additional analyses to identify those that are optimizable and rewrites the code so that it is more efficient. We evaluated our approach on a set of marketplace Android apps. In this evaluation, our approach reduced energy and runtime by 25% - 90%, depending on the workload assumption, and needed, on average, thirty-six seconds to analyze and transform each app.