Skip to main content
Log in

Characterizing the evolution of statically-detectable performance issues of Android apps

  • Published:
Empirical Software Engineering Aims and scope Submit manuscript

Abstract

Mobile apps are playing a major role in our everyday life, and they are tending to become more and more complex and resource demanding. Because of that, performance issues may occur, disrupting the user experience or, even worse, preventing an effective use of the app. Ultimately, such problems can cause bad reviews and influence the app success. Developers deal with performance issues thorough dynamic analysis, i.e., performance testing and profiler tools, albeit static analysis tools can be a valid, relatively inexpensive complement for the early detection of some such issues. This paper empirically investigates how potential performance issues identified by a popular static analysis tool — Android Lint — are actually resolved in 316 open source Android apps among 724 apps we analyzed. More specifically, the study traces the issues detected by Android Lint since their introduction until they resolved, with the aim of studying (i) the overall evolution of performance issues in apps, (ii) the proportion of issues being resolved, as well as (iii) the distribution of their survival time, and (iv) the extent to which issue resolution are documented by developers in commit messages. Results indicate how some issues, especially related to the lack of resource recycle, tend to be more frequent than others. Also, while some issues, primarily of algorithmic nature, tend to be resolved quickly through well-known patterns, others tend to stay in the app longer, or not to be resolved at all. Finally, we found how only 10% of the issue resolution is documented in commit messages.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Listing 1
Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20
Fig. 21

Similar content being viewed by others

Notes

  1. ACT. Act state of the app enconomy 2018, 2018.

  2. Findbugs™- find bugs in java programs. http://findbugs.sourceforge.net/.

  3. PMD - an extensible cross-language static code analyzer. https://pmd.github.io/.

  4. Android studio project site - Android Lint. http://tools.android.com/tips/lint.

  5. Findbugs™- find bugs in java programs. http://findbugs.sourceforge.net/.

  6. Soot - A framework for analyzing and transforming Java and Android applications. https://sable.github.io/soot/.

  7. At the time of writing only FindBugs also provides a dedicated category for performance-related issues, but it is not specific to Android apps.

  8. https://github.com/S2-group/AndroidPerformanceIssues

  9. https://github.com/features

  10. https://developer.github.com/v3/

  11. F-Droid - Free and Open Source Android App Repository. https://f-droid.org/en/.

  12. At the time of writing this paper (June 2018) the search functionality on FDroid appears to be broken or not working. Furthermore, the https://f-droid.org/forums/search/ endpoint that was used in the mining script does not exist anymore.

  13. Wikipedia page on open-source Android apps, 2017.

  14. https://developer.android.com/guide/topics/manifest/manifest-intro.html

  15. This check is sound since the web page of an app in the Google Play store follows a fixed pattern, i.e., https://play.google.com/store/apps/details?id=[app package name].

  16. Step 5 and Step 7 are redundant, we deliberately decided to keep both of them because during the execution of the dataset creation process we had to experiment with different heuristics in Step 7 and having it as a stand-alone step within the pipeline helped us in easily run it in isolation.

  17. http://developer.android.com/ndk

  18. We take advantage of the fact that issues in Android Lint reports are tagged with a fixed set of categories (http://tools.android.com/tips/lint-checks) like performance, correctness, accessibility, usability, etc.

  19. https://muhammad-asaduzzaman.com/research

  20. http://tools.android.com/tips/lint-checks

  21. Android floatmath documentation. https://developer.android.com/reference/android/util/FloatMath.

  22. In the remainder of the study we will refer to performance issues as P and to lines of code as LOC.

  23. It is important to note that we performed the statistical analysis for RQ3 both with and without outliers and the conclusions did not change

  24. https://git-scm.com/docs/git-log

  25. Android studio project site. http://tools.android.com/tips/lint.

  26. Sparsearray vs hashmap. http://www.sable.mcgill.ca/soot/.

  27. Android lint checks.

References

  • Ahmed TM, Bezemer C-P, Chen T-H, Hassan AE, Shang W (2016) Studying the effectiveness of application performance management (apm) tools for detecting performance regressions for web applications: an experience report. In: Proceedings of the 13th international conference on mining software repositories. ACM, pp 1–12

  • Asaduzzaman M, Roy CK, Schneider KA, Di Penta M (2013a) Lhdiff: a language-independent hybrid approach for tracking source code lines. In: 2013 29th IEEE International conference on software maintenance (ICSM). IEEE, pp 230–239

  • Asaduzzaman M, Roy CK, Schneider KA, Di Penta M (2013b) Lhdiff: tracking source code lines to support software maintenance activities. In: 2013 29th IEEE International conference on software maintenance (ICSM). IEEE, pp 484–487

  • Ayewah N, Pugh W, Hovemeyer D, Morgenthaler JD, Penix J (2008) Using static analysis to find bugs. IEEE Softw 25(5):22–29

    Article  Google Scholar 

  • Basili VR, Caldiera G, Rombach HD (1994) The goal question metric approach. In: Encyclopedia of software engineering. Wiley

  • Bessey A, Block K, Chelf B, Chou A, Fulton B, Hallem S, Henri-Gros C, Kamsky A, McPeak S, Engler D (2010) A few billion lines of code later: using static analysis to find bugs in the real world. Commun ACM 53(2):66–75

    Article  Google Scholar 

  • Chatzigeorgiou A, Manakos A (2014) Investigating the evolution of code smells in object-oriented systems. ISSE 10(1):3–18

    Google Scholar 

  • Cohen J (1968) Weighted kappa: nominal scale agreement provision for scaled disagreement or partial credit. Psychol Bull 70(4):213

    Article  Google Scholar 

  • Couto C, Montandon JE, Silva C, Valente MT (2011) Static correspondence and correlation between field defects and warnings reported by a bug finding tool. Softw Qual J 21:241–257

    Article  Google Scholar 

  • Cruz L, Abreu R (2017) Performance-based guidelines for energy efficient mobile applications. In: 4th IEEE/ACM International conference on mobile software engineering and systems, MOBILESoft@ICSE 2017, Buenos Aires, Argentina, May 22-23, 2017, pp 46–57

  • Cruz L, Abreu R (2018) Using automatic refactoring to improve energy efficiency of Android apps, arXiv:https://arxiv.org/abs/1803.05889

  • Das T, Di Penta M, Malavolta I (2016) A quantitative and qualitative investigation of performance-related commits in Android apps. In: ICSME ’16 Proceedings of the 32nd international conference on software maintenance and evolution. IEEE, pp 443–448

  • Di Penta M, Cerulo L, Aversano L (2009) The life and death of statically detected vulnerabilities: an empirical study. Inform Softw Technol 51(10):1469–1484

    Article  Google Scholar 

  • Dunn O (1964) Multiple comparisons using rank sums. Technometrics 6:241–252

    Google Scholar 

  • Foo KC, Jiang ZMJ, Adams B, Hassan AE, Zou Y, Flora P (2015) An industrial case study on the automated detection of performance regressions in heterogeneous environments. In: Proceedings of the 37th international conference on software engineering, vol 2. IEEE Press, pp 159–168

  • Gómez M, Rouvoy R, Adams B, Seinturier L (2016) Mining test repositories for automatic detection of UI performance regressions in Android apps. In: Proceedings of the 13th international conference on mining software repositories, MSR 2016, Austin, TX, USA, May 14-22, 2016, pp 13–24

  • Habchi S, Blanc X, Rouvoy R (2018) On adopting linters to deal with performance concerns in android apps. In: ASE18-proceedings of the 33rd IEEE/ACM international conference on automated software engineering, vol 11. ACM Press

  • Hassan F, Mostafa S, Lam ES, Wang X (2017) Automatic building of java projects in software repositories: a study on feasibility and challenges. In: 2017 ACM/IEEE International symposium on empirical software engineering and measurement (ESEM). IEEE, pp 38–47

  • Hecht G, Benomar O, Rouvoy R, Moha N, Duchien L (2015a) Tracking the software quality of android applications along their evolution (t). In: 2015 30th IEEE/ACM International conference on automated software engineering (ASE). IEEE, pp 236–247

  • Hecht G, Rouvoy R, Moha N, Duchien L (2015b) Detecting antipatterns in Android apps. In: 2nd ACM International conference on mobile software engineering and systems, MOBILESoft 2015, Florence, Italy, May 16-17, 2015, pp 148–149

  • Holm S (1979) A simple sequentially rejective Bonferroni test procedure. Scand J Stat 6:65–70

    MATH  Google Scholar 

  • Huchard M, Kästner C, Fraser G (eds) (2018) Proceedings of the 33rd ACM/IEEE international conference on automated software engineering, ASE 2018, Montpellier, France, September 3-7, 2018. ACM, New York

  • Joorabchi ME, Mesbah A, Kruchten P (2013) Real challenges in mobile app development. In: 2013 ACM / IEEE International symposium on empirical software engineering and measurement, pp 15–24

  • Kalliamvakou E, Gousios G, Blincoe K, Singer L, German DM, Damian D (2016) An in-depth study of the promises and perils of mining github. Empir Softw Eng 21(5):2035–2071

    Article  Google Scholar 

  • Kim S, Ernst MD (2007) Which warnings should I fix first?. In: Proceedings of the joint meeting of the European software engineering conference and the ACM SIGSOFT international symposium on foundations of software engineering (ESEC/FSE), pp 45–54

  • Kruskal WH, Wallis A (1952) Use of ranks in one-criterion variance analysis. J Am Stat Assoc 47:583–621

    Article  Google Scholar 

  • Leffingwell D (2010) Agile software requirements: lean requirements practices for teams, programs, and the enterprise. Addison-Wesley Professional

  • Li L, Bissyandé TF, Papadakis M, Rasthofer S, Bartel A, Octeau D, Klein J, Le Traon Y (2017) Static analysis of android apps: a systematic literature review. Information and Software Technology

  • Lidwell W, Holden K, Butler J (2010) Universal principles of design revised and updated: 125 ways to enhance usability, influence perception, increase appeal, make better design decisions, and teach through design, 2nd edn. Rockport Publishers

  • Liu Y, Xu C, Cheung S (2014) Characterizing and detecting performance bugs for smartphone applications. In: 36th International conference on software engineering, ICSE ’14, Hyderabad, India - May 31 - June 07, 2014, pp 1013–1024

  • Malik H, Hemmati H, Hassan AE (2013) Automatic detection of performance deviations in the load testing of large scale systems. In: Proceedings of the 2013 international conference on software engineering. IEEE Press, pp 1012–1021

  • Munson JC, churn S. G. Elbaum. (1998) Code A measure for estimating the impact of code change. In: International Conference on software maintenance, 1998. Proceedings. IEEE, pp 24–31

  • Nielson F, Nielson HR, Hankin C (2015) Principles of program analysis. Springer

  • Nistor A, Ravindranath L (2014) Suncat: helping developers understand and predict performance problems in smartphone applications. In: International symposium on software testing and analysis, ISSTA ’14, San Jose, CA, USA - July 21 - 26, 2014, pp 282–292

  • Palomba F, Di Nucci D, Panichella A, Zaidman A, De Lucia A (2017) Lightweight detection of Android-specific code smells: the adoctor project. In: IEEE 24th International conference on software analysis, evolution and reengineering, SANER 2017, Klagenfurt, Austria, February 20-24, 2017, pp 487–491

  • Palomba F, Vásquez ML, Bavota G, Oliveto R, Di Penta M, Poshyvanyk D, De Lucia A (2018) Crowdsourcing user reviews to support the evolution of mobile apps. J Syst Softw 137:143–162

    Article  Google Scholar 

  • Pascarella L, Geiger F-X, Palomba F, Di Nucci D, Malavolta I, Bacchelli A (2018) Self-reported activities of android developers. In: 5th IEEE/ACM International conference on mobile software engineering and systems, page to appear. ACM, New York

  • Qian F, Wang Z, Gerber A, Mao ZM, Sen S, Spatscheck O (2011) Profiling resource usage for mobile applications: a cross-layer approach. In: Proceedings of the 9th international conference on mobile systems, applications, and services (MobiSys 2011), Bethesda, MD, USA, June 28 - July 01, 2011, pp 321–334

  • Ravindranath L, Padhye J, Agarwal S, Mahajan R, Obermiller I, Shayandeh S (2012) Appinsight: mobile app performance monitoring in the wild. In: 10th USENIX Symposium on operating systems design and implementation, OSDI 2012, Hollywood, CA, USA, October 8-10, 2012, pp 107–120

  • Reimann J, Brylski M, Aßmann U (2014) A tool-supported quality smell catalogue for Android developers. Softwaretechnik-Trends, 34(2)

  • Rosenberg J (2008) Statistical methods and measurement. In: Guide to advanced empirical software engineering. Springer, pp 155–184

  • Sadowski C, Aftandilian E, Eagle A, Miller-Cushon L, Jaspan C (2018) Lessons from building static analysis tools at google. Commun ACM 61(4):58–66

    Article  Google Scholar 

  • Shull F, Singer J, Sjøberg DI (2007) Guide to advanced empirical software engineering. Springer

  • Spacco J, Hovemeyer D, Pugh W (2006) Tracking defect warnings across versions. In: Proceedings of the 2006 international workshop on mining software repositories. ACM, pp 133–136

  • Spencer D (2009) Card sorting: designing usable categories. Rosenfeld Media

  • Sulír M, Porubän J (2016) A quantitative study of java software buildability. In: Proceedings of the 7th international workshop on evaluation and usability of programming languages and tools. ACM, pp 17–25

  • Tufano M, Palomba F, Bavota G, Oliveto R, Di Penta M, De Lucia A, Poshyvanyk D (2017) When and why your code starts to smell bad (and whether the smells go away). IEEE Trans Softw Eng 43(11):1063–1088

    Article  Google Scholar 

  • Tufano M, Watson C, Bavota G, Di Penta M, White M, Poshyvanyk D (2019) An empirical study on learning bug-fixing patches in the wild via neural machine translation. ACM Trans Softw Eng Methodol 28(4):19,1–19,29. https://doi.org/10.1145/3340544

    Article  Google Scholar 

  • Vásquez ML, Vendome C, Luo Q, Poshyvanyk D (2015) How developers detect and fix performance bottlenecks in Android apps. In: 2015 IEEE International conference on software maintenance and evolution, ICSME 2015, Bremen, Germany, September 29 - October 1, 2015, pp 352–361

  • Wedyan F, Alrmuny D, Bieman JM (2009) The effectiveness of automated static analysis tools for fault detection and refactoring prediction. In: 2009 International conference on software testing verification and validation. IEEE, pp 141–150

  • Wohlin C, Runeson P, Höst M, Ohlsson M, Regnell B, Wesslén A (2012) Experimentation in software engineering. Computer Science. Springer

  • Zaman S, Adams B, Hassan AE (2012) A qualitative study on performance bugs. In: Proceedings of the 9th IEEE working conference on mining software repositories. IEEE Press, pp 199–208

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ivano Malavolta.

Additional information

Communicated by: Ahmed E. Hassan

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Appendix A: Examples of Android Performance-Related Issues

Listing 2
figure z

Example of Recycle issue (dstahlke/rdn-wallpaper - src/org/stahlke/rdnwallpaper/ PresetsBox.java)

Listing 3
figure aa

Example of bursty occurrences of the UseValueOf issue (dyne/ZShaolin - termapk/src/com/ spartacusrex/spartacuside/keyboard/TerminalKeyboard.java)

Listing 4
figure ab

Example of UseSparseArrays issue (ric03uec/cramit - src/com/dev/cramit/models/ Problem.java)

Listing 5
figure ac

Example of HandlerLeak issue (mobiRic/StackFlairWidget - src/com/mobiric/ stackflairwidget/service/ FlairWidgetService.java)

Listing 6
figure ad

Example of HandlerLeak issue (alistairdickie/ BlueFlyVario _Android - src/com/bfv/hardware/ HardwareListActivity.java)

Listing 7
figure ae

Example of DrawAllocation issue (kurtmc/MyEarnings - src/com/mcalpine development/calculatepay/ CalculateActivity.java)

Listing 8
figure af

Example of FloatMath issue (dirktrossen/AIRS - src/com/airs/TimelineActivity.java)

Listing 9
figure ag

Example of ViewHolder issue (asksven/BetterWifiOnOff - BetterWifiOnOff/src/com/ asksven/betterwifionoff/CreditsAdapter.java)

Appendix B: Catalog of Solutions for Statically-Detectable Performance Issues

In the following, we present a catalog of solutions for statically-detectable performance issues as emerged from our analysis. All the examples of solutions are available in Appendix B.

Recycle

To resolve the Recycle issues in the project uberspot/AnagramSolver, developers purposely add the lines of code to close the cursor properly after being used. It can be seen in code snippet (Fig. 22 in Appendix B) that developers use cursor.close() at the end (at line 174) to close the database query cursor properly and this changes in source code led to resolution of Recycle issues from the project. Whereas, in other (Recycle) category, Recycle issue was solved in the project shlusiak/Freebloks-Android by recycling the resource, i.e., by calling the p.recycle() method (see lines 540 and 569 in Fig. 23).

Fig. 22
figure 22

Example of resolving of the Recycle issue (username115/FRCScouting - src/org/frc836/ database/DB.java)

Fig. 23
figure 23

Example of resolving of the Recycle issue (shlusiak/Freebloks-Android - src/de/ saschahlusiak/freebloks/game/FreebloksActivity.java)

ViewHolder

To resolve this issue developers should implement ViewHolder pattern in getView() callbacks. For example, it can be noted from the manual observation that developers specially implemented ViewHolder Pattern for ExerciseImageListAdapter to resolve the ViewHolder issue from the project chaosbastler/opentraining (an example from our dataset) as shown in Fig. 24. The idea is to reuse earlier recycled list items. It prevents the inflation of list items layout when there are recycled items available for reuse (Lines 99-100). When the list of items is created for the first time, the references to inner view object are identified and stored in a particular data structure for reuse (Lines 95-96). The main advantages of using the ViewHolder pattern are that (1) it can save computation for inflation of list items layout by reducing findViewById() calls and also invokes less inner view retrieval computations, and (2) it is memory efficient for building new list items. Furthermore, to reduce the impact of frequently invoked callbacks in getView() implementation, developers should use this kind of efficient design.

Fig. 24
figure 24

Example of resolving of the ViewHolder issue (chaosbastler/opentraining - app/src/de/skubware/opentraining/activity/create_exercise/ExerciseImageListAdapter.java)

HandlerLeak

To resolve the HandlerLeak type of issues in the project stdev293/ battery-waster-android, developers declared the handler as static class. It can be clearly shown from Fig. 25, that developers create a new static class for the handler to avoid the potential memory leaks. Moreover, developers also used a WeakReference to outer class and pass the object to instantiate a handler.

Fig. 25
figure 25

Example of resolving of the HandlerLeak issue (stdev293/battery-waster-android - src/com/stdev293/batterywasterdemo/sinks/SinksControlThread.java)

UseSparseArrays

We manually analyzed the source code of several projects to know how the UseSparseArrays issue type is resolved, we observed that for better performance of memory server storage, developer removed HashMaps and used UseSparseArrays instead. One of the sample documented example can be shown in the Fig. 26 (from our dataset) where the UseSparseArrays type of issue is resolved from the project pocmo/Yaaic.

Fig. 26
figure 26

Example of resolving of the UseSparseArrays issue (pocmo/Yaaic - app/src/main/java/ org/yaaic/db/Database.java)

However, UseSparseArrays are assumed to be more memory efficient and trigger less garbage collection as compared to its counterpart HashMaps with no key impact on operations performance of maps. Moreover, SparseArrays allocate less memory as compared to HashMaps.Footnote 26

DrawAllocation

Related to DrawAllocation issue category, we consider the mchow01/FingerDoodle project to analyze the solution.

From our manual analysis, we observed that developer removed the Paint object from onDraw() function (i.e., a background Paint object is created each time when the draw operation takes place and memory is allocate every time) as shown in Fig. 27 (Appendix B). To resolve this issue, developer pre-allocate the background Paint (at line 18) upfront (i.e., outside from onDraw() function) and reuse it instead, which will prevent from the UI lag since memory will not allocate at each time when onDraw() or Layout() function is called. Therefore, it is a good suggestion for developers to allocate new object before the draw or layout operation.Footnote 27

Fig. 27
figure 27

Example of resolving of the DrawAllocation issue (mchow01/FingerDoodle - src/edu/cs/ tufts/mchow/FingerDoodleView.java)

FloatMath

For the FloatMath issue type, instead of FloatMath declaration, developers should use Math in the source code to resolve this issue. It can be noted from the Fig. 28 (Appendix B), that after depreciated from FloatMath to Math (as developer wrote in commit note), the FloatMath issue is resolved. In the following we report the commit message provided by the developer when resolving this issue.

Fig. 28
figure 28

Example of resolving of the FloatMath issue (almalence/OpenCamera - src/com/almalence/ plugins/capture/panoramaaugmented/PanoramaAugmentedCapturePlugin.java)

“Partially fixed issue with preview on Android 6 in camera2 mode. Fixed nexus naming in CC. Changed deprecated FloatMath to Math.” This issue type focuses on the primitives data types, so developers can get rid of this issue by using Math in the source code.

UseValueOf

Regarding the UseValueOf type of issues, following is the commit message developer wrote after resolving this issue from the project AmrutSai/sikuna.

“Made changes based on recommendations from the lint tool... and removed unused strings. Preferences have been renamed to Settings. This also no longer appears in the ActionBar on Honeycomb and above... following recommendations at the Android design site. Changed Settings display based on these recommendations also. Made plenty of changes in BusStopDatabase and SettingsDatabase to follow good practices and possible performance enhancements.”

As shown in Fig. 29, the developer used a call to valueOf (at line 310) to resolve this issue.

Fig. 29
figure 29

Example of resolving of the UseValueOf issue (AmrutSai/sikuna - src/uk/org/rivernile/ edinburghbustracker/android/MainActivity.java)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Das, T., Di Penta, M. & Malavolta, I. Characterizing the evolution of statically-detectable performance issues of Android apps. Empir Software Eng 25, 2748–2808 (2020). https://doi.org/10.1007/s10664-019-09798-3

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10664-019-09798-3

Keywords

Navigation