[1D6]RE-view of Android L developer PRE-view

Post on 01-Dec-2014

901 views 1 download

description

DEVIEW 2014 [1D6]RE-view of Android L developer PRE-view

Transcript of [1D6]RE-view of Android L developer PRE-view

이경민

LG전자

RE-view of

Android L Developer

PRE-view

http://developer.android.com/preview/index.html

1

http://developer.android.com/preview/index.html

1 2

http://developer.android.com/preview/index.html

Material Design

Goals- Create a visual language that synthesizes classic principles of good

design with the innovation and possibility of technology and science.

- Develop a single underlying system that allows for a unified experience

across platforms and device sizes. Mobile precepts are fundamental,

but touch, voice, mouse, and keyboard are all first-class input methods.

Material is the metaphor Bold, graphic, intentional Motion provides meaning

Principles

http://www.google.com/design/spec/material-design/introduction.html

Android Runtimehttps://android-review.googlesource.com/#/c/98553/

https://android-review.googlesource.com/#/c/98374/

Android Runtimehttps://android-review.googlesource.com/#/c/98553/

https://android-review.googlesource.com/#/c/98374/

Dalvik is dead, long live Dalvik! DO NOT MERGE

Android Runtimehttps://android-review.googlesource.com/#/c/98553/

https://android-review.googlesource.com/#/c/98374/

Dalvik is dead, long live Dalvik! DO NOT MERGE

Android Runtimehttps://android-review.googlesource.com/#/c/98553/

https://android-review.googlesource.com/#/c/98374/

Dalvik is dead, long live Dalvik! DO NOT MERGE

Key Architectural Changes in L

Key Architectural Changes in L

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

Key Architectural Changes in L

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

Key Architectural Changes in L

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

③ Garbage Collection ModelLess and shorter pauses and less fragmentation

Agenda

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

③ Garbage Collection ModelLess and shorter pauses and less fragmentation

Render Thread in Lhttp://www.youtube.com/watch?v=3TtVsy98ces

①①

Render Thread in Lhttp://www.youtube.com/watch?v=3TtVsy98ces

Render Thread in Lhttp://www.youtube.com/watch?v=3TtVsy98ces

Render Thread in Lhttp://www.youtube.com/watch?v=3TtVsy98ces

One of the most exciting topics that was glossed

over was the introduction of a dedicated render

thread. The goal of the render thread is to

take many of the atomic animationsintroduced with material design and

perform them autonomously, so they don’t hold

up the primary UI toolkit thread.

Source: http://www.willowtreeapps.com/blog/google-io-from-the-

trenches-android-l-and-material-design/

UI (Main) Thread

Activity

Thread

Hello

Android

.apkActivity

Looper

Message

Queue

Service

BroadcastReceiver

ContentProvider

H

handleMessage()

ViewRootImpl

handleMessage()

TLS

Threaded

Task

Binder

Object

Storage

(File,Prefs,DB,Network)

Window

Android

Manifest.xml

Resources

Intent

ViewsViews

Views

Application

Instru

me

nta

tion

test.apkTest Case

Looper, Message Queue, and Handler

GPUI - UI on the GPU (Honeycomb~)

Source: Google I/O 2011 – Accelerated Android Rendering

GPUI - UI on the GPU (Honeycomb~)

Source: Google I/O 2011 – Accelerated Android Rendering

CPU Rasterization

GPU Composition

GPUI - UI on the GPU (Honeycomb~)

Increased

Number of

Pixels

Source: Google I/O 2011 – Accelerated Android Rendering

CPU Rasterization

GPU Composition

GPUI - UI on the GPU (Honeycomb~)

Increased

Number of

Pixels

Source: Google I/O 2011 – Accelerated Android Rendering

CPU Rasterization

GPU Composition

GPU Rasterization

GPU Composition

GPUI - UI on the GPU (Honeycomb~)

GPUI

Display List

View Layers

Display List

Properties

Increased

Number of

Pixels

Source: Google I/O 2011 – Accelerated Android Rendering

CPU Rasterization

GPU Composition

GPU Rasterization

GPU Composition

Display ListA display list records a series of graphics related operation and can replay them later.

Display lists are usually built by recording operations on a android.graphics.Canvas.

Replaying the operations from a display list avoids executing views drawing code on every

frame, and is thus much more efficient.

DisplayList::Op[Non-Drawing]

<<enumeration>>

+Save

+Restore

+RestoreToCount

+SaveLayer

+SaveLayerAlpha

+Translate

+Rotate

+Scale

+Skew

+SetMatrix

+ConcatMatrix

+ClipRect

DisplayList::Op[Drawing]

<<enumeration>>

+DrawDisplayList

+DrawLayer

+DrawBitmap

+DrawBitmapMatrix

+DrawBitmapRect

+DrawBitmapData

+DrawBitmapMesh

+DrawPatch

+DrawColor

+DrawRect

+DrawRoundRect

+DrawCircle

+DrawOval

+DrawArc

+DrawPath

+DrawLines

+DrawPoints

+DrawText

+DrawTextOnPath

+DrawPosText

+ResetShader

+SetupShader

+ResetColorFilter

+SetupColorFilter

+ResetShadow

+SetupShadow

+ResetPaintFilter

+SetupPaintFilter

+DrawGLFunction

OpenGLRenderer

drawDisplayList(…)

DisplayList

replay(…)

DisplayListRenderer

draw*(…, SkPaint)

void* buffer

SkWriter32

write*(…)

SkReader32

read*()

GLES20RecordingCanvas

draw*(…, Paint)

android_view_

GLES20Canvas_draw*(…)

GLES20Canvas

drawDisplayList(…)

draw*(…, SkPaint)

GLES2/gl2.h

glXXX(…)

Source: 10th Kandroid Conference – Skia and FreeType: Android 2D Graphics Essentials

Display ListA display list records a series of graphics related operation and can replay them later.

Display lists are usually built by recording operations on a android.graphics.Canvas.

Replaying the operations from a display list avoids executing views drawing code on every

frame, and is thus much more efficient.

DisplayList::Op[Non-Drawing]

<<enumeration>>

+Save

+Restore

+RestoreToCount

+SaveLayer

+SaveLayerAlpha

+Translate

+Rotate

+Scale

+Skew

+SetMatrix

+ConcatMatrix

+ClipRect

DisplayList::Op[Drawing]

<<enumeration>>

+DrawDisplayList

+DrawLayer

+DrawBitmap

+DrawBitmapMatrix

+DrawBitmapRect

+DrawBitmapData

+DrawBitmapMesh

+DrawPatch

+DrawColor

+DrawRect

+DrawRoundRect

+DrawCircle

+DrawOval

+DrawArc

+DrawPath

+DrawLines

+DrawPoints

+DrawText

+DrawTextOnPath

+DrawPosText

+ResetShader

+SetupShader

+ResetColorFilter

+SetupColorFilter

+ResetShadow

+SetupShadow

+ResetPaintFilter

+SetupPaintFilter

+DrawGLFunction

OpenGLRenderer

drawDisplayList(…)

DisplayList

replay(…)

DisplayListRenderer

draw*(…, SkPaint)

void* buffer

SkWriter32

write*(…)

SkReader32

read*()

GLES20RecordingCanvas

draw*(…, Paint)

android_view_

GLES20Canvas_draw*(…)

GLES20Canvas

drawDisplayList(…)

draw*(…, SkPaint)

GLES2/gl2.h

glXXX(…)

Source: 10th Kandroid Conference – Skia and FreeType: Android 2D Graphics Essentials

Display List: An Example

DrawDisplayList

DrawPatch

Save

Translate

ConcatMatrix

DrawBitmap

RestoreToCount

$ adb shell dumpsys gfxinfo [pid|pname]

JB (API Level 18)

Source: 12th Kandroid Conference – Terminology and History of Android Performance Features

Android Animation

Drawable Animation

Frame(-by-Frame)

Animation

View Animation

Tween(ed) Animation Property Animation

What

Showing a sequence of

images in order

Performing a series of

transformations on a

single image

Modifying an object's

property values over a set

period of time

Added/

Updated

1 1, 4 11, 16, 18, 19

APIsandroid.graphics.drawable.

AnimationDrawable

android.view.animation.* android.animation.*

(2011/02) Animation in Honeycomb

http://android-developers.blogspot.kr/2011/02/animation-in-honeycomb.html

(2011/05) Introducing ViewPropertyAnimator

http://android-developers.blogspot.kr/2011/05/introducing-viewpropertyanimator.html

(2011/11) Android 4.0 Graphics and Animations

http://android-developers.blogspot.kr/2011/11/android-40-graphics-and-animations.html

Source: 13th Kandroid MinMax – Silky Rendering Choreographer and Animation

Property Animation (Pre-Jellybean)

Source: 13th Kandroid MinMax – Silky Rendering Choreographer and Animation

ValueAnimatordoAnimationFrame()

TimeInterpolatorgetInterpolation()

Elapsed Fraction

TypeEvaluatorevaluate()

Interpolated Fraction

Current Value

Frame Time

( Frame Time – Start Time ) / Duration

Math.pow ( Elapsed Fraction, 2 Factor )

e.g., AccelerateInterpolator

AnimatorUpdateListeneronAimationUpdate()

Start Value + ( End Value – Start Value )

Interpolated Fraction

Thread Local Storage

sendEmptyMessageDelayed()

w/ ANIMATION_FRAME

handleMessage()

sendEmptyMessage()

w/ ANIMATION_START

AnimationHandler

start()

1

2

3 4

5

6

7

8

Drawing w/ Single UI Thread

Activity

SurfaceFlinger

Event

Set

Property

Value

Invalidate

Measure

&

Layout

Prepare

Draw

Update

DisplayList

Draw

DisplayList

Swap

Buffers

Display

List

Dequeue

Buffer

Composite

Windows

Post

Buffer

Enqueue

Buffer

Something

Happens

Draw

Display

Drawing w/ UI & Render Threads

Activity

SurfaceFlinger

Event

Set

Property

Value

Invalidate

Measure

&

Layout

Prepare

Draw

Update

DisplayList

Draw

DisplayList

Swap

Buffers

Display

List

Dequeue

Buffer

Composite

Windows

Post

Buffer

Enqueue

Buffer

Something

Happens

Draw

Display

Render Thread

Threads in Action

Threads in KitKat

Threads in Action

Threads in KitKat

Threads in Action

Threads in KitKat Threads in L

Threads in Action

Threads in KitKat Threads in L

Food for Further Review

Food for Further Review

Comparison w/ Other Technology/Platforms

Food for Further Review

Comparison w/ Other Technology/Platforms• Windows Phone: UI & Compositor Thread,

Storyboard-based vs. Timer-based Animationshttp://blogs.telerik.com/windowsphoneteam/posts/10-12-13/ui-vs-compositor-demystifying-the-

main-windows-phone-7-os-threads.aspx

Food for Further Review

Comparison w/ Other Technology/Platforms• Windows Phone: UI & Compositor Thread,

Storyboard-based vs. Timer-based Animationshttp://blogs.telerik.com/windowsphoneteam/posts/10-12-13/ui-vs-compositor-demystifying-the-

main-windows-phone-7-os-threads.aspx

• Web Animations: Javascript-based vs. CSS-basedhttp://www.html5rocks.com/en/tutorials/speed/high-performance-animations/

Food for Further Review

Comparison w/ Other Technology/Platforms• Windows Phone: UI & Compositor Thread,

Storyboard-based vs. Timer-based Animationshttp://blogs.telerik.com/windowsphoneteam/posts/10-12-13/ui-vs-compositor-demystifying-the-

main-windows-phone-7-os-threads.aspx

• Web Animations: Javascript-based vs. CSS-basedhttp://www.html5rocks.com/en/tutorials/speed/high-performance-animations/

Implications to Application Developers

Food for Further Review

Comparison w/ Other Technology/Platforms• Windows Phone: UI & Compositor Thread,

Storyboard-based vs. Timer-based Animationshttp://blogs.telerik.com/windowsphoneteam/posts/10-12-13/ui-vs-compositor-demystifying-the-

main-windows-phone-7-os-threads.aspx

• Web Animations: Javascript-based vs. CSS-basedhttp://www.html5rocks.com/en/tutorials/speed/high-performance-animations/

Implications to Application Developers• Property Animation vs. Atomic Animation?

Agenda

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

③ Garbage Collection ModelLess and shorter pauses and less fragmentation

Performance Boosting Thing

“Can u guys add some performance

boosting thing on the next version”

Performance Boosting Thing

“Can u guys add some performance

boosting thing on the next version”

Performance Boosting Thing

“Can u guys add some performance

boosting thing on the next version”

Performance Boosting Thing

“Can u guys add some performance

boosting thing on the next version”

Performance Boosting Thing

PBT == ART

Source: Google I/O 2014 – The ART Runtime

PBT == ART

Ahead-Of-Time (AOT)

Source: Google I/O 2014 – The ART Runtime

PBT == ART

Ahead-Of-Time (AOT)

Garbage Collection

Source: Google I/O 2014 – The ART Runtime

PBT == ART

Ahead-Of-Time (AOT)

Garbage Collection

64-bit Support

Source: Google I/O 2014 – The ART Runtime

Dalvik VM: Register-based

※ Stack, Accumulator, Register machine

Stack machine : 0-operand instruction set

Accumulator machine : 1-operand …

Register machine : 2 or 3-operand …

000b: iload 05

000d: iload 04

000f: if_icmpge 0024

0012: aload_3

0013: iload 05

0015: iaload

0016: istore 06

0018: lload_1

0019: iload 06

001b: i2l

001c: ladd

001d: lstore_1

001e: iinc 05, #+01

0021: goto 000b

0007: if-ge v0, v2, 0010

0009: aget v1, v8, v0

000b: int-to-long v5, v1

000c: add-long/2addr v3, v5

000d: add-int/lit8 v0, v0, #int 1

000f: goto 0007

Java VM(JVM) bytecode

Dalvik VM(DVM) bytecode

Items JVM DVM

bytes 25 18

dispatches 14 6

reads 45 19

writes 16 6

public static long sumArray(int[] arr) {

long sum = 0;

For (int i : arr) {

sum += i;

}

return sum;

}

Just-In-Time Compiler (Froyo~)

Source: Google I/O 2010 – A JIT Compiler for Android's Dalvik VM

Just-In-Time Compiler (Froyo~)

Source: Google I/O 2010 – A JIT Compiler for Android's Dalvik VM

When to Compile?

What to Compile?

AOT Compiler (L~)

Source: Google I/O 2014 – The ART Runtime

AOT Compiler (L~)

When to Compile?

What to Compile?

Source: Google I/O 2014 – The ART Runtime

.art / .oat / .odex

Source: Google I/O 2014 – The ART Runtime

AOT in Action

~~

~

AOT in Action

~~

~

AOT in Action

~~

~

AOT in Action

~~

~

AOT in Action

~~

~

JIT vs. AOT

AOT Jazelle®

• Ahead of Time Compilation

• WIPI의 COD (Compile-on-

demand) 방식

• Java bytecode를 CPU가바로실행함.

(arm/thumb/java mode)

JIT

• Just-in-Time Compilation

소프트웨어가속 하드웨어가속

• 10x ~ 15x • 6x ~ 10x• 6x ~ 10x

• 어플리케이션크기가커짐. • 프로파일링및컴파일시간이있어실행초기느려질수있음.

► 모바일단말에서는 JIT와 Jazelle® 사용이일반화되어있음.

► 어플리케이션크기가커지는것을제외하면, AOT 방식이최대성능을보일수있음.

Source: 1st kandroid Seminar – Dalvik VM vs. Java VM (류혁곤 님 발표)

JIT vs. AOT

AOT Jazelle®

• Ahead of Time Compilation

• WIPI의 COD (Compile-on-

demand) 방식

• Java bytecode를 CPU가바로실행함.

(arm/thumb/java mode)

JIT

• Just-in-Time Compilation

소프트웨어가속 하드웨어가속

• 10x ~ 15x • 6x ~ 10x• 6x ~ 10x

• 어플리케이션크기가커짐. • 프로파일링및컴파일시간이있어실행초기느려질수있음.

► 모바일단말에서는 JIT와 Jazelle® 사용이일반화되어있음.

► 어플리케이션크기가커지는것을제외하면, AOT 방식이최대성능을보일수있음.

Source: 1st kandroid Seminar – Dalvik VM vs. Java VM (류혁곤 님 발표)

Speed/Space

JIT vs. AOT

AOT Jazelle®

• Ahead of Time Compilation

• WIPI의 COD (Compile-on-

demand) 방식

• Java bytecode를 CPU가바로실행함.

(arm/thumb/java mode)

JIT

• Just-in-Time Compilation

소프트웨어가속 하드웨어가속

• 10x ~ 15x • 6x ~ 10x• 6x ~ 10x

• 어플리케이션크기가커짐. • 프로파일링및컴파일시간이있어실행초기느려질수있음.

► 모바일단말에서는 JIT와 Jazelle® 사용이일반화되어있음.

► 어플리케이션크기가커지는것을제외하면, AOT 방식이최대성능을보일수있음.

Source: 1st kandroid Seminar – Dalvik VM vs. Java VM (류혁곤 님 발표)

Optimization Window

Speed/Space

JIT vs. AOT

AOT Jazelle®

• Ahead of Time Compilation

• WIPI의 COD (Compile-on-

demand) 방식

• Java bytecode를 CPU가바로실행함.

(arm/thumb/java mode)

JIT

• Just-in-Time Compilation

소프트웨어가속 하드웨어가속

• 10x ~ 15x • 6x ~ 10x• 6x ~ 10x

• 어플리케이션크기가커짐. • 프로파일링및컴파일시간이있어실행초기느려질수있음.

► 모바일단말에서는 JIT와 Jazelle® 사용이일반화되어있음.

► 어플리케이션크기가커지는것을제외하면, AOT 방식이최대성능을보일수있음.

Source: 1st kandroid Seminar – Dalvik VM vs. Java VM (류혁곤 님 발표)

Optimization Window

Memory Sharing

Speed/Space

Food for Further Review

Food for Further Review

Comparison w/ Other Technology/Platforms

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: JIT and (Full) AOT

http://www.mono-project.com/docs/advanced/aot/

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: JIT and (Full) AOT

http://www.mono-project.com/docs/advanced/aot/

• .NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspx

http://en.wikipedia.org/wiki/Native_Image_Generator

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: JIT and (Full) AOT

http://www.mono-project.com/docs/advanced/aot/

• .NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspx

http://en.wikipedia.org/wiki/Native_Image_Generator

Implications to Application Developers

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: JIT and (Full) AOT

http://www.mono-project.com/docs/advanced/aot/

• .NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspx

http://en.wikipedia.org/wiki/Native_Image_Generator

Implications to Application Developers• Getter/Setter vs. Direct Access to Field?

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: JIT and (Full) AOT

http://www.mono-project.com/docs/advanced/aot/

• .NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspx

http://en.wikipedia.org/wiki/Native_Image_Generator

Implications to Application Developers• Getter/Setter vs. Direct Access to Field?

• Small vs. Large Method?

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: JIT and (Full) AOT

http://www.mono-project.com/docs/advanced/aot/

• .NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspx

http://en.wikipedia.org/wiki/Native_Image_Generator

Implications to Application Developers• Getter/Setter vs. Direct Access to Field?

• Small vs. Large Method?

• Java-only vs. JNI w/ C/C++?

Agenda

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

③ Garbage Collection ModelLess and shorter pauses and less fragmentation

Changes in GC: WHY?

Changes in GC: WHY?

192MB RAM

320X480

2008

HTC G1

Changes in GC: WHY?

1GB RAM

1280X800

2011

Motorola Xoom

192MB RAM

320X480

2008

HTC G1

Changes in GC: WHY?

1GB RAM

1280X800

2011

Motorola Xoom

192MB RAM

320X480

2008

HTC G1

2GB/3GB RAM

2560X1440

2014

LG G3

Changes in GC: WHY?

Bigger Heaps

1GB RAM

1280X800

2011

Motorola Xoom

192MB RAM

320X480

2008

HTC G1

2GB/3GB RAM

2560X1440

2014

LG G3

Changes in GC: WHY?

Bigger Heaps

Longer GC Pauses

1GB RAM

1280X800

2011

Motorola Xoom

192MB RAM

320X480

2008

HTC G1

2GB/3GB RAM

2560X1440

2014

LG G3

Changes in GC: WHY?

Bigger Heaps

Longer GC Pauses

Poor UI Responsiveness

1GB RAM

1280X800

2011

Motorola Xoom

192MB RAM

320X480

2008

HTC G1

2GB/3GB RAM

2560X1440

2014

LG G3

Changes in GC: WHAT?

Changes in GC: WHAT?

Pre-Gingerbread• Stop-the-world

• Full heap collection

• Pause time often > 100ms

Gingerbread to Kitkat• Concurrent Mark and Sweep (CMS)

• Partial collections

• Pause time usually < 5ms

Source: Google I/O 2011 – Memory management for Android Apps

Changes in GC: WHAT?

Pre-Gingerbread• Stop-the-world

• Full heap collection

• Pause time often > 100ms

Gingerbread to Kitkat• Concurrent Mark and Sweep (CMS)

• Partial collections

• Pause time usually < 5ms

Source: Google I/O 2011 – Memory management for Android Apps

Serial vs. Parallel

Concurrent vs. Stop-The-World

Compacting vs. Non-compacting

vs. Copying

Changes in GC: WHAT?

Pre-Gingerbread• Stop-the-world

• Full heap collection

• Pause time often > 100ms

Gingerbread to Kitkat• Concurrent Mark and Sweep (CMS)

• Partial collections

• Pause time usually < 5ms

Source: Google I/O 2011 – Memory management for Android Apps

Serial vs. Parallel

Concurrent vs. Stop-The-World

Compacting vs. Non-compacting

vs. Copying

Source: http://www.somanyword.com/2014/01/how-

memory-management-garbage-collector-works-in-java-

and-difference-types-of-garbage-collectors-in-java/

http://www.slideshare.net/dougqh/understanding-

garbage-collection

Understanding Garbage Collection

Changes in GC: WHAT?

L and Beyond• One GC pause instead of two

• Parallelized processing during the remaining GC pause

• Background sticky concurrent mark sweep GC: Collector with lower pause

time for the special case of cleaning up recently-allocated, short-lived objects

• Improved garbage collection ergonomics, making concurrent garbage

collections more timely, which makes GC_FOR_ALLOC events extremely rare

in typical use cases

Source: Introducing ART (https://source.android.com/devices/tech/dalvik/art.html)

Changes in GC: WHAT?

L and Beyond• One GC pause instead of two

• Parallelized processing during the remaining GC pause

• Background sticky concurrent mark sweep GC: Collector with lower pause

time for the special case of cleaning up recently-allocated, short-lived objects

• Improved garbage collection ergonomics, making concurrent garbage

collections more timely, which makes GC_FOR_ALLOC events extremely rare

in typical use cases

Source: Introducing ART (https://source.android.com/devices/tech/dalvik/art.html)

Source: http://en.wikipedia.org/wiki/Human_factors_and_ergonomics

인간공학(人間工學, ergonomics)이란 인간과그들이 사용하는 물건과의 상호작용을 다루는학문이다. 인간공학은 인간의 기계화가 아닌인간을 위한 공학(design for human)을 말한다. 즉, 인간의 행동, 능력, 한계, 특성 등에 관한 정보를발견하고, 이를 도구, 기계, 시스템, 과업, 직무, 환경을 설계하는 데 응용함으로써 인간이생산적이고 안전하며 쾌적한 환경에서 작업을 하고물건을 효과적으로 이용할 수 있도록 하는 것이다.

[네이버 지식백과] 인간공학 [Ergonomics](학문명백과 : 공학, 형설출판사)

Changes in GC: WHAT?

L and Beyond• One GC pause instead of two

• Parallelized processing during the remaining GC pause

• Background sticky concurrent mark sweep GC: Collector with lower pause

time for the special case of cleaning up recently-allocated, short-lived objects

• Improved garbage collection ergonomics, making concurrent garbage

collections more timely, which makes GC_FOR_ALLOC events extremely rare

in typical use cases

Source: Introducing ART (https://source.android.com/devices/tech/dalvik/art.html)

Source: http://en.wikipedia.org/wiki/Human_factors_and_ergonomics

인간공학(人間工學, ergonomics)이란 인간과그들이 사용하는 물건과의 상호작용을 다루는학문이다. 인간공학은 인간의 기계화가 아닌인간을 위한 공학(design for human)을 말한다. 즉, 인간의 행동, 능력, 한계, 특성 등에 관한 정보를발견하고, 이를 도구, 기계, 시스템, 과업, 직무, 환경을 설계하는 데 응용함으로써 인간이생산적이고 안전하며 쾌적한 환경에서 작업을 하고물건을 효과적으로 이용할 수 있도록 하는 것이다.

[네이버 지식백과] 인간공학 [Ergonomics](학문명백과 : 공학, 형설출판사)

Tuning Garbage Collection with

the 5.0 Java[tm] Virtual Machine

http://www.oracle.com/technetwork/java/

gc-tuning-5-138395.html

Garbage Collector Ergonomics

http://docs.oracle.com/javase/7/docs/technotes/

guides/vm/gc-ergonomics.html

Two Pauses One Pause

Source: Google I/O 2014 – The ART runtime

Two Pauses One Pause

Source: Google I/O 2014 – The ART runtime

Two Pauses One Pause

Source: Google I/O 2014 – The ART runtime

Long Pause for GC_FOR_ALLOC

Source: Google I/O 2014 – The ART runtime

Long Pause for GC_FOR_ALLOC

Source: Google I/O 2014 – The ART runtime

Reducing Heap FragmentationSource: Google I/O 2014 – The ART runtime

Reducing Heap FragmentationSource: Google I/O 2014 – The ART runtime

GC Logs

GC_HPROF_DUMP_HEAP freed 47K, 50% free 2730K/5379K, external 8825K/9762K, paused 2262ms

GC_EXPLICIT freed 39K, 49% free 3434K/6727K, external 1625K/2137K, paused 61ms

GC_EXTERNAL_ALLOC freed 113K, 48% free 2849K/5447K, external 2069K/2137K, paused 29ms

GC_FOR_MALLOC freed 672K, 46% free 4505K/8263K, external 1625K/2137K, paused 36ms

GC_EXPLICIT freed 298K, 5% free 9395K/9820K, paused 5ms+4ms, total 46ms

GC_FOR_ALLOC freed 62K, 4% free 9981K/10356K, paused 14ms, total 14ms

GC_CONCURRENT freed 452K, 5% free 11442K/11924K, paused 2ms+3ms, total 32ms

GC_BEFORE_OOM freed <1K, 25% free 48653K/64327K, paused 20ms

Gingerbread

L Preview

Explicit concurrent mark sweep GC

freed 65595(3MB) AllocSpace objects, 9(4MB) LOS objects, 810% free, 38MB/58MB,

paused 1.195ms total 87.219ms

Background partial concurrent mark sweep GC

freed 74626(3MB) AllocSpace objects, 39(4MB) LOS objects, 1496% free, 25MB/32MB,

paused 4.422ms total 1.371747s

Background sticky concurrent mark sweep GC

freed 70319(3MB) AllocSpace objects, 59(5MB) LOS objects, 825% free, 49MB/56MB,

paused 6.139ms total 52.868ms

Source : http://www.anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/2

GC Logs

GC_HPROF_DUMP_HEAP freed 47K, 50% free 2730K/5379K, external 8825K/9762K, paused 2262ms

GC_EXPLICIT freed 39K, 49% free 3434K/6727K, external 1625K/2137K, paused 61ms

GC_EXTERNAL_ALLOC freed 113K, 48% free 2849K/5447K, external 2069K/2137K, paused 29ms

GC_FOR_MALLOC freed 672K, 46% free 4505K/8263K, external 1625K/2137K, paused 36ms

GC_EXPLICIT freed 298K, 5% free 9395K/9820K, paused 5ms+4ms, total 46ms

GC_FOR_ALLOC freed 62K, 4% free 9981K/10356K, paused 14ms, total 14ms

GC_CONCURRENT freed 452K, 5% free 11442K/11924K, paused 2ms+3ms, total 32ms

GC_BEFORE_OOM freed <1K, 25% free 48653K/64327K, paused 20ms

Gingerbread

L Preview

Explicit concurrent mark sweep GC

freed 65595(3MB) AllocSpace objects, 9(4MB) LOS objects, 810% free, 38MB/58MB,

paused 1.195ms total 87.219ms

Background partial concurrent mark sweep GC

freed 74626(3MB) AllocSpace objects, 39(4MB) LOS objects, 1496% free, 25MB/32MB,

paused 4.422ms total 1.371747s

Background sticky concurrent mark sweep GC

freed 70319(3MB) AllocSpace objects, 59(5MB) LOS objects, 825% free, 49MB/56MB,

paused 6.139ms total 52.868ms

Source : http://www.anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/2

GC Cause• Alloc

• Background

• Explicit

• NativeAlloc

• CollectorTransition

• DisableMovingGc

• HomogeneousSpaceCompact

• HeapTrim

GC Logs

GC_HPROF_DUMP_HEAP freed 47K, 50% free 2730K/5379K, external 8825K/9762K, paused 2262ms

GC_EXPLICIT freed 39K, 49% free 3434K/6727K, external 1625K/2137K, paused 61ms

GC_EXTERNAL_ALLOC freed 113K, 48% free 2849K/5447K, external 2069K/2137K, paused 29ms

GC_FOR_MALLOC freed 672K, 46% free 4505K/8263K, external 1625K/2137K, paused 36ms

GC_EXPLICIT freed 298K, 5% free 9395K/9820K, paused 5ms+4ms, total 46ms

GC_FOR_ALLOC freed 62K, 4% free 9981K/10356K, paused 14ms, total 14ms

GC_CONCURRENT freed 452K, 5% free 11442K/11924K, paused 2ms+3ms, total 32ms

GC_BEFORE_OOM freed <1K, 25% free 48653K/64327K, paused 20ms

Gingerbread

L Preview

Explicit concurrent mark sweep GC

freed 65595(3MB) AllocSpace objects, 9(4MB) LOS objects, 810% free, 38MB/58MB,

paused 1.195ms total 87.219ms

Background partial concurrent mark sweep GC

freed 74626(3MB) AllocSpace objects, 39(4MB) LOS objects, 1496% free, 25MB/32MB,

paused 4.422ms total 1.371747s

Background sticky concurrent mark sweep GC

freed 70319(3MB) AllocSpace objects, 59(5MB) LOS objects, 825% free, 49MB/56MB,

paused 6.139ms total 52.868ms

Source : http://www.anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/2

GC Cause• Alloc

• Background

• Explicit

• NativeAlloc

• CollectorTransition

• DisableMovingGc

• HomogeneousSpaceCompact

• HeapTrim

GC Type• Sticky

• Partial

• Full

GC Logs

GC_HPROF_DUMP_HEAP freed 47K, 50% free 2730K/5379K, external 8825K/9762K, paused 2262ms

GC_EXPLICIT freed 39K, 49% free 3434K/6727K, external 1625K/2137K, paused 61ms

GC_EXTERNAL_ALLOC freed 113K, 48% free 2849K/5447K, external 2069K/2137K, paused 29ms

GC_FOR_MALLOC freed 672K, 46% free 4505K/8263K, external 1625K/2137K, paused 36ms

GC_EXPLICIT freed 298K, 5% free 9395K/9820K, paused 5ms+4ms, total 46ms

GC_FOR_ALLOC freed 62K, 4% free 9981K/10356K, paused 14ms, total 14ms

GC_CONCURRENT freed 452K, 5% free 11442K/11924K, paused 2ms+3ms, total 32ms

GC_BEFORE_OOM freed <1K, 25% free 48653K/64327K, paused 20ms

Gingerbread

L Preview

Explicit concurrent mark sweep GC

freed 65595(3MB) AllocSpace objects, 9(4MB) LOS objects, 810% free, 38MB/58MB,

paused 1.195ms total 87.219ms

Background partial concurrent mark sweep GC

freed 74626(3MB) AllocSpace objects, 39(4MB) LOS objects, 1496% free, 25MB/32MB,

paused 4.422ms total 1.371747s

Background sticky concurrent mark sweep GC

freed 70319(3MB) AllocSpace objects, 59(5MB) LOS objects, 825% free, 49MB/56MB,

paused 6.139ms total 52.868ms

Source : http://www.anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/2

GC Cause• Alloc

• Background

• Explicit

• NativeAlloc

• CollectorTransition

• DisableMovingGc

• HomogeneousSpaceCompact

• HeapTrim

GC Type• sticky

• partial

• (full)

Collector Type• mark sweep

• concurrent mark sweep

• mark compact

• marksweep + semispace

• concurrent copying + mark sweep

GC Logs

GC_HPROF_DUMP_HEAP freed 47K, 50% free 2730K/5379K, external 8825K/9762K, paused 2262ms

GC_EXPLICIT freed 39K, 49% free 3434K/6727K, external 1625K/2137K, paused 61ms

GC_EXTERNAL_ALLOC freed 113K, 48% free 2849K/5447K, external 2069K/2137K, paused 29ms

GC_FOR_MALLOC freed 672K, 46% free 4505K/8263K, external 1625K/2137K, paused 36ms

GC_EXPLICIT freed 298K, 5% free 9395K/9820K, paused 5ms+4ms, total 46ms

GC_FOR_ALLOC freed 62K, 4% free 9981K/10356K, paused 14ms, total 14ms

GC_CONCURRENT freed 452K, 5% free 11442K/11924K, paused 2ms+3ms, total 32ms

GC_BEFORE_OOM freed <1K, 25% free 48653K/64327K, paused 20ms

Gingerbread

L Preview

Explicit concurrent mark sweep GC

freed 65595(3MB) AllocSpace objects, 9(4MB) LOS objects, 810% free, 38MB/58MB,

paused 1.195ms total 87.219ms

Background partial concurrent mark sweep GC

freed 74626(3MB) AllocSpace objects, 39(4MB) LOS objects, 1496% free, 25MB/32MB,

paused 4.422ms total 1.371747s

Background sticky concurrent mark sweep GC

freed 70319(3MB) AllocSpace objects, 59(5MB) LOS objects, 825% free, 49MB/56MB,

paused 6.139ms total 52.868ms

Source : http://www.anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/2

GC Cause• Alloc

• Background

• Explicit

• NativeAlloc

• CollectorTransition

• DisableMovingGc

• HomogeneousSpaceCompact

• HeapTrim

GC Type• sticky

• partial

• (full)

Collector Type• mark sweep

• concurrent mark sweep

• mark compact

• marksweep + semispace

• concurrent copying + mark sweep

Food for Further Review

Food for Further Review

Comparison w/ Other Technology/Platforms

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector

http://www.mono-project.com/docs/advanced/garbage-collector/sgen/

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector

http://www.mono-project.com/docs/advanced/garbage-collector/sgen/

• V8: Stop-the-world, Generational, Accurate Garbage Collectorhttps://developers.google.com/v8/design#garb_coll

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector

http://www.mono-project.com/docs/advanced/garbage-collector/sgen/

• V8: Stop-the-world, Generational, Accurate Garbage Collectorhttps://developers.google.com/v8/design#garb_coll

• Blink: Garbage Collection for Blink C++ objects (a.k.a. Oilpan)http://www.chromium.org/blink/blink-gc

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector

http://www.mono-project.com/docs/advanced/garbage-collector/sgen/

• V8: Stop-the-world, Generational, Accurate Garbage Collectorhttps://developers.google.com/v8/design#garb_coll

• Blink: Garbage Collection for Blink C++ objects (a.k.a. Oilpan)http://www.chromium.org/blink/blink-gc

Implications to Application Developers

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector

http://www.mono-project.com/docs/advanced/garbage-collector/sgen/

• V8: Stop-the-world, Generational, Accurate Garbage Collectorhttps://developers.google.com/v8/design#garb_coll

• Blink: Garbage Collection for Blink C++ objects (a.k.a. Oilpan)http://www.chromium.org/blink/blink-gc

Implications to Application Developers• Primitive Values vs. Tiny/Short-lived Objects?

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector

http://www.mono-project.com/docs/advanced/garbage-collector/sgen/

• V8: Stop-the-world, Generational, Accurate Garbage Collectorhttps://developers.google.com/v8/design#garb_coll

• Blink: Garbage Collection for Blink C++ objects (a.k.a. Oilpan)http://www.chromium.org/blink/blink-gc

Implications to Application Developers• Primitive Values vs. Tiny/Short-lived Objects?• Explicit GC w/ System.gc()?

Food for Further Review

Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector

http://www.mono-project.com/docs/advanced/garbage-collector/sgen/

• V8: Stop-the-world, Generational, Accurate Garbage Collectorhttps://developers.google.com/v8/design#garb_coll

• Blink: Garbage Collection for Blink C++ objects (a.k.a. Oilpan)http://www.chromium.org/blink/blink-gc

Implications to Application Developers• Primitive Values vs. Tiny/Short-lived Objects?• Explicit GC w/ System.gc()?

• JNI Code Incompatible with Compacting GC

Summary

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

③ Garbage Collection ModelLess and shorter pauses and less fragmentation

Summary

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

③ Garbage Collection ModelLess and shorter pauses and less fragmentation

(Software) Engineering is all about

Summary

① UI Threading ModelSingle UI (Main) Thread UI & Render Thread

② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation

③ Garbage Collection ModelLess and shorter pauses and less fragmentation

(Software) Engineering is all about

TRADE-OFF!!!

Q&A

THANK YOU