characterizing and detecting performance bugs for...

66
Characterizing and Detecting Performance Bugs for Smartphone Applications Yepang Liu 1 , Chang Xu 2 , and S.C. Cheung 1 1 The Hong Kong University of Science and Technology 2 State Key Lab for Novel Software Technology, Nanjing University

Upload: others

Post on 11-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Characterizing and Detecting Performance Bugs for Smartphone Applications

Yepang Liu1, Chang Xu2, and S.C. Cheung1

1The Hong Kong University of Science and Technology2State Key Lab for Novel Software Technology, Nanjing University

Page 2: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Smartphone Era

1 million+ apps

1/30

Apps for different purposes

Page 3: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

App performance is critical

2/30

11,108 of 60,000 Android apps randomly sampled

from Google Play suffer from performance bugs!

Page 4: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

App performance is critical

3/30

Page 5: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

App performance is critical

3/30

App not respondingÆWrong way

Page 6: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

App performance is critical

4/30

Bad performance

User complaints

Market failure

Page 7: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Assuring good performance is NOT easy

• Small team• No dedicated QA

5/30

Page 8: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Assuring good performance is NOT easy

• Small team• No dedicated QA

5/30

• Limited bug understanding• Lack of useful tool support

Page 9: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Assuring good performance is NOT easy

• Fierce competition• Short time to market

• Small team• No dedicated QA

5/30

• Limited bug understanding• Lack of useful tool support

Page 10: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

How can we help?

Designing performance assurance tools

Understanding performance bugs

6/30

Page 11: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Overview

• Empirical study: understanding performance bug

– Research questions and study design

– Empirical findings and implications

• PerfChecker: a performance bug detection tool

– Tool design and implementation

– Detected bugs and developers’ feedback

Page 12: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Overview

• Empirical study: understanding performance bug

– Research questions and study design

– Empirical findings and implications

• PerfChecker: a performance bug detection tool

– Tool design and implementation

– Detected bugs and developers’ feedback

Page 13: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Research questions

• RQ1: Bug types and impact

• RQ2: Bug manifestation

• RQ3: Debugging and bug-fixing effort

• RQ4: Common bug patterns

7/30

Page 14: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Application and bug selection

8 popular Android apps with well-maintainedbug tracking system and code repository

8/30

Page 15: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Selected apps

Application name Category Size (LOC) Downloads

Firefox Communication 122.9K 10M ~ 50M

Chrome Communication 77.3K 50M ~ 100M

AnkiDroid Education 44.8K 500K ~ 1M

K-9 Mail Communication 76.2K 1M ~ 5M

My Tracks Health & Fitness 27.1K 10M ~ 50M

c:geo Entertainment 44.7K 1M ~ 5M

Open GPS Tracker Travel & Local 18.1K 100K ~ 500K

Zmanim Books & Reference 5.0K 10K ~ 50K

9/30

Page 16: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Application and bug selection

9/30

70 fixed performance bugs labeled by original developers

8 popular Android apps with well-maintainedbug tracking system and code repository

Page 17: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Empirical study process

70 Performance bugs

Bug reports, comments

Bug fixing patches

Patch reviews

Revision commit logs …

Research questions

Bug types and impacts

Bug manifestation

Debugging and fixing effort

Common bug patterns

10/30

Page 18: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Overview

• Empirical study: understanding performance bug

– Research questions and study design

– Empirical findings and implications

• PerfChecker: a static performance analysis tool

– Analysis tool design and features

– Detected bugs and developers’ feedback

Page 19: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

24

View my items

SHOPPING CART

Three dominant bug types

1. GUI lagging: Significantly reducing the responsiveness andsmoothness of an application’s GUI (75.7%)

11/30

Page 20: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Three dominant bug types

1. GUI lagging: Significantly reducing the responsiveness andsmoothness of an application’s GUI (75.7%)

“Switching tabs is too slow, sometimes cantake 5 – 10 seconds, triggering Application NotResponding error.” (Firefox bug 719493)

11/30

Page 21: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Three dominant bug types

2. Energy leak: Applications quickly and silently consumemuch battery power (14.3%)

12/30

Page 22: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Three dominant bug types

2. Energy leak: Applications quickly and silently consumemuch battery power (14.3%)

“My Tracks is a massive battery drain. Battery lost10% in standby just 20 minutes after a full charge.”

“It is destroying my battery. I will have to uninstallit if there isn’t a fix soon.” (My Tracks bug 520)

12/30

Page 23: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Three dominant bug types

3. Memory bloat: Applications consume significantly morememory than necessary (11.4%)

13/30

Page 24: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Three dominant bug types

3. Memory bloat: Applications consume significantly morememory than necessary (11.4%)

“I went to a few websites, played < 10 minutes,5.6 MB memory is consumed … causing crasheson Galaxy S4.” (Chrome bug 245782)

13/30

Page 25: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Three dominant bug types

3. Memory bloat: Applications consume significantly morememory than necessary (11.4%)

“I went to a few websites, played < 10 minutes,5.6 MB memory is consumed … causing crasheson Galaxy S4.” (Chrome bug 245782)

13/30

GUI lagging, energy leak and memory bloat are three dominanttypes in our studied performance bugs.

Page 26: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Observation 1: Special user interactions needed to exposeperformance bugs (25 / 70)

Manifesting performance bugs

14/30

Page 27: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Manifesting performance bugs

14/30

Zmanim energy leak reproducing steps

• Step 1: Switch on GPS

• Step 2: Configure Zmanim to use current location

• Step 3: Start Zmanim’s main activity

• Step 4: Press “Home” button when GPS is acquiring a location

Page 28: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Manifesting performance bugs

14/30

Zmanim energy leak reproducing steps

• Step 1: Switch on GPS

• Step 2: Configure Zmanim to use current location

• Step 3: Start Zmanim’s main activity

• Step 4: Press “Home” button when GPS is acquiring a location

These bugs make performance testing difficult /

Page 29: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

How to trigger performance bugs?

15/30

Zmanim energy leak reproducing steps

• Step 1: Switch on GPS

• Step 2: Configure Zmanim to use current location

• Step 3: Start Zmanim’s main activity

• Step 4: Press “Home” button when GPS is acquiring a location

Sequence

Page 30: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

How to trigger performance bugs?

15/30

Zmanim energy leak reproducing steps

• Step 1: Switch on GPS

• Step 2: Configure Zmanim to use current location

• Step 3: Start Zmanim’s main activity

• Step 4: Press “Home” button when GPS is acquiring a location

Sequence Timing (app state)+

Page 31: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Performance oracles

Observation 2: No well-defined performance oracle

• Performance bugs rarely cause fail-stop consequences

16/30

Page 32: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Performance oracles

Observation 2: No well-defined performance oracle

• Performance bugs rarely cause fail-stop consequences

16/30

How do developers judge performance degradation in reality?

Page 33: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Performance oracles

Three common judgment strategies in practice:

• Manual judgment

16/30

Page 34: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Performance oracles

Three common judgment strategies in practice:

• Manual judgment

• Product comparison

16/30

vs.

K-9 Mail Gmail

Page 35: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Performance oracles

Three common judgment strategies in practice:

• Manual judgment

• Product comparison

• Developers’ consensus

16/30

“Generally, 100 ms is the threshold beyond whichusers will perceive slowness in application.”

Page 36: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Performance oracles

Three common judgment strategies in practice:

• Manual judgment (manual effort)

• Product comparison (manual effort)

• Developers’ consensus (not well defined)

17/30

Automated and well-defined oracles are desirable to facilitateperformance testing and analysis.

Page 37: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Performance oracles

Three common judgment strategies in practice:

• Manual judgment (manual effort)

• Product comparison (manual effort)

• Developers’ consensus (not well defined)

17/30

General oracles may not exist. Bug specific oracles are still helpful.(Zhang et al. CODES+ISSS’12, Liu et al. PerCom’13, TSE’14)

Page 38: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Common bug patterns

Observation: More than one third of performance bugs are

amenable to automated detection.

We observed three common bug patterns:

• Long running operations in main threads

• Wasted computation for invisible GUI

• Inefficient callbacks (frequently invoked)

18/30

Page 39: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

1. Long running operations in main threads

How to keep your applications responsive?

“Android applications normally run entirely on a single thread. By

default, it is the UI thread or main thread, which drives the user

interface event loop. Any method that runs in the main thread

should do as little work as possible.” (Android documentation)

19/30

Page 40: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

1. Long running operations in main threads

24

View my items

SHOPPING CART

19/30

Long running operations will prevent the main thread from handling user events timely

Page 41: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

2. Wasted computation for invisible GUI

A dilemma:

• One great feature of Android is multitasking

• Potential drawback: bad apps conducting useless computation inbackground can eat up precious battery life

“I have noticed there are a few people who have phones wherethere is software running in the background that just sort ofexhausts the battery quickly.” (Larry Page, Google’s co-founder)

20/30

Page 42: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

“When Fennec is in the background, these things should be

suspended ideally: timers / JavaScript, animated images, Dom

events, audio / video, flash plugins.” (Firefox bug 736311)

Firefox energy leak: • Video keeps running on

background tabs

20/30

2. Wasted computation for invisible GUI

Page 43: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

3. Inefficient frequently-invoked callbacks

21/30

Android application

Callback 1 Callback 2

Callback n

Page 44: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

3. Inefficient frequently-invoked callbacks

21/30

Android application

Callback 1 Callback 2

Callback n

Frequently-invoked callbacks should be highly efficient.

Page 45: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

22/30

Text 1

Text 2

Text 3

Text 4

Text 1

Text 2

Text 3

Text 4Scro

lling

ListView callback example

Old item

New item

Page 46: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Text 1

Text 2

Text 3

Text 4

Text 1

Text 2

Text 3

Text 4Scro

lling

Old item

New item

ListView callback example

22/30

public View getView(int pos, View recycledView, ...)• Operation 1: item layout inflation• Operation 2: inner view updating

Page 47: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Text 1

Text 2

Text 3

Text 4

Text 1

Text 2

Text 3

Text 4Scro

lling

Old item

New item

public View getView(int pos, View recycledView, ...)• Operation 1: item layout inflation• Operation 2: inner view updating

ListView callback example

Efficiency is critical (tens of invocations during a scrolling)

22/30

Heavy operations!

Page 48: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Observation: List items have identical layout

public View getView(int pos, View recycledView, ...)

22/30

Text 1

Text 2

Text 3

Text 4

Text 1

Text 2

Text 3

Text 4Scro

lling

View holder design pattern

Old item

New item

System recycler

Page 49: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

public View getView(int pos, View recycledView, ...)System recycler

Text 1

22/30

Text 1

Text 2

Text 3

Text 4

Text 1

Text 2

Text 3

Text 4Scro

lling

View holder design pattern

Old item

New item

Observation: List items have identical layout

Idea: Recycle old item and cache inner view references for reuseRecycle

Page 50: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

public View getView(int pos, View recycledView, ...)System recycler

Text 1Reuse

22/30

Text 1

Text 2

Text 3

Text 4

Text 1

Text 2

Text 3

Text 4Scro

lling

View holder design pattern

Old item

New item

Observation: List items have identical layout

Idea: Recycle old item and cache inner view references for reuseRecycle

Page 51: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Violating view holder design pattern

23/30

//Simplified from Firefox bug 735736

public View getView(int pos, View recycledView, ViewGroup parent) {

View item = mInflater.inflate(R.layout.listItem, null);

TextView txtView = (TextView) item.findViewById(R.id.text);

ImageView imgView = (ImageView) item.findViewById(R.id.icon);

txtView.setText(DATA[pos]);

imgView.setImageBitmap((pos % 2) == 1 ? mIcon1 : mIcon2);

return item;

}

Page 52: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Violating view holder design pattern

//Simplified from Firefox bug 735736

public View getView(int pos, View recycledView, ViewGroup parent) {

View item = mInflater.inflate(R.layout.listItem, null);

TextView txtView = (TextView) item.findViewById(R.id.text);

ImageView imgView = (ImageView) item.findViewById(R.id.icon);

txtView.setText(DATA[pos]);

imgView.setImageBitmap((pos % 2) == 1 ? mIcon1 : mIcon2);

return item;

}

Recycled item not used at allitem inflation and inner view updating on each call!

23/30

Consequence: bad scrolling performance!

Yepang Liu
(735636)
Page 53: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Overview

• Empirical study: understanding performance bug

– Research questions and study design

– Empirical findings and implications

• PerfChecker: a performance bug detection tool

– Tool design and implementation

– Detected bugs and developers’ feedback

Page 54: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

PerfChecker

• Static analysis for performance bug detection

24/30

.apk .class

Analysis Report

PerfChecker

Warnings & suggestions

or

Bug patterns

Page 55: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

PerfChecker

24/30

• Static analysis for performance bug detection

• Fully automated and easy to use

Input Output

.apk .class

Analysis Report

PerfChecker

Warnings & suggestions

or

Bug patterns

Page 56: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Implementation

25/30

.apk .class

PerfChecker

or

Code analysis engine: Soot

Bug patterns

Performance bug checkers

• Long running operations in main threads• View holder pattern violations

Analysis Report

Page 57: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Application subjects

Latest version of 29 popular open-source Android apps

• Covering 12 different categories

• 1+ million lines of Java code in total

Application name Category Size (LOC) Downloads

c:geo Entertainment 37.7K 1M ~ 5M

Osmand Travel & Local 77.4K 500K ~ 1M

Firefox Communication 122.9K 10M ~ 50M

FBReaderJ Books & Reference 103.4K 5M ~ 10M

Bitcoin Wallet Finance 35.1K 100K ~ 500K

OI File Manager Productivity 7.8K 5M ~ 10M

… … … …

26/30

Page 58: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Analysis results

• PerfChecker can finish analyzing each application in afew seconds to a few minutes

27/30

Page 59: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Analysis results

• PerfChecker detected 126 previously-unknown issues in18 of the 29 analyzed applications

27/30

Application nameBug pattern instances

View holder pattern violation

Long running operations in main threads

Ushahidi 9 2

Firefox 1 0

FBReaderJ 6 6

OI File Manager 1 0

… … ...

Page 60: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Analysis results

• 68 issues (54.0%) were confirmed as real performancebugs by original developers

Application nameBug pattern instances

View holder pattern violation

Long running operations in main threads

Ushahidi 9 2

Firefox 1 0

FBReaderJ 6 6

OI File Manager 1 0

… … ...

27/30

Page 61: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Analysis results

• 20 critical performance bugs were quickly fixed by original application developers

27/30

Application nameBug pattern instances

View holder pattern violation

Long running operations in main threads

Ushahidi 9 2

Firefox 1 0

FBReaderJ 6 6

OI File Manager 1 0

… … ...

Page 62: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Feedback from developers

• Developers are interested in performance analyzers

28/30

Henry (Ushahidi developer)

“Thanks for reporting this … Just curious, where

is this static code checker? Anywhere I can play

with it as well?”

Page 63: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Feedback from developers

• Developers act quickly with concrete suggestions

28/30

“Thanks a lot for reporting the problems.

The ViewHolder pattern has just been added to

the BookmarkListAdapter in 8c9c429.”

George (OI File Manager developer)

Page 64: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

One of our checkers merged into Android Studio (for IntelliJ)

Android Studio 0.5.2 Release LogPosted on Mar 20, 2014 by Tor Norbye

• New Lint check:

Ensures that list view adapters usethe View Holder pattern (to makescrolling smoother) …

Latest news

29/30

Page 65: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Conclusion

• We discussed several characteristics of performance bug

• Performance bug detection tools are helpful to developers

• Future work on improving PerfChecker

– More bug patterns to boost its detection capability

– Improve the effectiveness of bug detection algorithms

30/30

For empirical study data and tool runnable, please visit:http://sccpu2.cse.ust.hk/perfchecker/

Page 66: Characterizing and Detecting Performance Bugs for ...sccpu2.cse.ust.hk/andrewust/files/ICSE2014_presentation.pdf · Characterizing and Detecting Performance Bugs for Smartphone Applications

Thank you -