android ui performance & overdraw

23
©2014 GlobalLogic Inc. CONFIDENTIAL

Upload: globallogic-ukraine

Post on 01-Jul-2015

1.515 views

Category:

Engineering


2 download

DESCRIPTION

This presentation is about the essence of overdraw and the problems it causes. There are also hints on finding and overcoming overdraw. Presentation by Rostyslav Lesovyi (Lead Software Engineer, GlobalLogic, Lviv) and Oleksandr Kravchenko (Software Engineer, GlobalLogic, Lviv) delivered at GlobalLogic Lviv Mobile TechTalk, November 13, 2014. More details - http://www.globallogic.com.ua/press-releases/lviv-mobile-2014-coverage

TRANSCRIPT

Page 1: Android UI Performance & Overdraw

©2014 GlobalLogic Inc. CONFIDENTIAL

Page 2: Android UI Performance & Overdraw

©2014 GlobalLogic Inc. CONFIDENTIAL

Android UI PerformanceOverdraw problem

Page 3: Android UI Performance & Overdraw

CONFIDENTIAL

1. What is overdraw?

2. Why is overdraw bad?

3. How to detect and fight overdraw?

Agenda

Page 4: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

What is overdraw?

Page 5: Android UI Performance & Overdraw

CONFIDENTIAL

What is overdraw?

Layer #1

Layer #2

Layer #3

Layer #4

Page 6: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

Why is overdraw so bad?

Page 7: Android UI Performance & Overdraw

CONFIDENTIAL

Smooth user experience

16ms 16ms 16ms 16ms

Frame takes < 16ms 13ms 10ms 8ms 15ms

Frame takes > 16ms 13ms 18ms 18ms

Dropped Frame

Screen refresh rate ~60 Hz

t

Page 8: Android UI Performance & Overdraw

CONFIDENTIAL

Mobile vs. Desktop - Smartest Android in the World!!!

GF

lops

Adreno 330

130

Page 9: Android UI Performance & Overdraw

CONFIDENTIAL

Mobile vs. Desktop - Is not so smart after all...

Adreno 330

130

AM

D A

10

Inte

l HD

500

0

615 500

GF

lops

GF

lops

NV

idia

GT

X T

itan

AM

D 7

970

GH

z

4500 4300

Page 10: Android UI Performance & Overdraw

CONFIDENTIAL

Mobile vs. Desktop - But there is still hope!

Adreno 330

130

GF

lops

AM

D A

10

Inte

l HD

500

0

615 500

GF

lops

Page 11: Android UI Performance & Overdraw

CONFIDENTIAL

Android Devices Zoo

Hi-End devicesNexus 6, Samsung Galaxy S5, HTC One, etc.

Can handle most issues without influencing user experience even with complex UI hierarchy

Page 12: Android UI Performance & Overdraw

CONFIDENTIAL

Android Devices Zoo

Low-End devicesmost pre-ICS devices like HTC Wildfire S

Some devices can deliver smooth user experience for simple UI, other will fail even for optimal UI

Note: most embedded devices go here

Page 13: Android UI Performance & Overdraw

CONFIDENTIAL

Android Devices Zoo

Mid-End devicesNexus S, Samsung Galaxy S2, HTC Sensation, etc.

Capable of creating smooth user experience but can easily fail if UI is not optimized

Note: most STB devices go here

Page 14: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

How to detect and fight overdraw?

Page 15: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

How to detect overdraw?

1. Show GPU overdraw (enable developers mode on phone)

2. Hierarchy viewer (requires ViewServer library for released devices)

3. Tracer for OpenGL

Page 16: Android UI Performance & Overdraw

CONFIDENTIAL

● No color means there is no overdraw. So, you are awesome!

● Blue indicates an overdraw of 1x.

● Green indicates an overdraw of 2x.

● Light red indicates an overdraw of 3x.

● Dark red indicates an overdraw of 4x or more. This is wrong. Fix it.

How to detect overdraw with “GPU overdraw”?

Page 17: Android UI Performance & Overdraw

CONFIDENTIAL

1. Select Hierarchy viewer perspective in ADT or Device monitor

2. Select a window that you want to inspect

3. Click Load button

4. Export it as Photoshop document when needed

How to detect overdraw with “Hierarchy viewer”?

Page 18: Android UI Performance & Overdraw

CONFIDENTIAL

1. Select Tracer for OpenGL perspective in ADT or Device monitor

2. Click Collects OpenGL information

3. Set package and activity

4. Check traces.

How to detect overdraw with “Tracer for OpenGL”?

Page 19: Android UI Performance & Overdraw

CONFIDENTIAL

● draw less :)

● flatten and simplify view hierarchy

● change window’s background when applicable

● transparent segments for 9-patch won’t be drawn, but transparent bitmaps will

How to fight overdraw?

P.S.:● never ever use requestLayout() for animations

● be careful with layers and dynamically changing views

Page 20: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

Demo Time!

Page 21: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

Demo

Page 22: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

Q&A

Page 23: Android UI Performance & Overdraw

CONFIDENTIAL©2014 GlobalLogic Inc.

Rostyslav Lesovyi Oleksandr Kravchenko

Thank You!