SlideShare a Scribd company logo
이경민 
LG전자 
RE-viewofAndroid L DeveloperPRE-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 
Motionprovides meaning 
Principles 
http://www.google.com/design/spec/material-design/introduction.html
Android Runtime 
https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/
Android Runtime 
https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/ 
Dalvikis dead, long live Dalvik! DO NOT MERGE
Android Runtime 
https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/ 
Dalvikis dead, long live Dalvik! DO NOT MERGE
Android Runtime 
https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/ 
Dalvikis dead, long live Dalvik! DO NOT MERGE
Key Architectural Changes in L
Key Architectural Changes in L 
①UI Threading Model 
Single UI (Main) Thread UI & Render Thread
Key Architectural Changes in L 
①UI Threading Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation
Key Architectural Changes in L 
①UI Threading Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation 
③Garbage Collection Model 
Less and shorter pauses and less fragmentation
Agenda 
①UI Threading Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation 
③Garbage Collection Model 
Less and shorter pauses and less fragmentation
Render Thread in L 
http://www.youtube.com/watch?v=3TtVsy98ces 
① 
① 
②
Render Thread in L 
http://www.youtube.com/watch?v=3TtVsy98ces 
②
Render Thread in L 
http://www.youtube.com/watch?v=3TtVsy98ces
Render Thread in L 
http://www.youtube.com/watch?v=3TtVsy98ces 
One of the most exciting topics that was glossed over was the introduction of a dedicatedrender thread. The goal of the render threadis to take many of the atomic animationsintroduced with material designand 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 
ThreadHelloAndroid.apk 
Activity 
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 
Views 
Views 
Views 
Application 
Instrumentation test.apk 
Test 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 RasterizationGPU 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 RasterizationGPU Composition
Display List 
A 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>> 
+Sav e 
+Restore 
+RestoreToCount 
+Sav eLayer 
+Sav eLayerAlpha 
+Translate 
+Rotate 
+Scale 
+Skew 
+SetMatrix 
+ConcatMatrix 
+ClipRect 
DisplayList::Op[Drawing] 
<<enumeration>> 
+DrawDisplayList 
+DrawLayer 
+DrawBitmap 
+DrawBitmapMatrix 
+DrawBitmapRect 
+DrawBitmapData 
+DrawBitmapMesh 
+DrawPatch 
+DrawColor 
+DrawRect 
+DrawRoundRect 
+DrawCircle 
+DrawOv al 
+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 
A 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>> 
+Sav e 
+Restore 
+RestoreToCount 
+Sav eLayer 
+Sav eLayerAlpha 
+Translate 
+Rotate 
+Scale 
+Skew 
+SetMatrix 
+ConcatMatrix 
+ClipRect 
DisplayList::Op[Drawing] 
<<enumeration>> 
+DrawDisplayList 
+DrawLayer 
+DrawBitmap 
+DrawBitmapMatrix 
+DrawBitmapRect 
+DrawBitmapData 
+DrawBitmapMesh 
+DrawPatch 
+DrawColor 
+DrawRect 
+DrawRoundRect 
+DrawCircle 
+DrawOv al 
+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 
$ adbshell dumpsysgfxinfo[pid|pname] 
JB (API Level 18) 
Source: 12thKandroid Conference –Terminology and History of Android Performance Features
Android Animation 
DrawableAnimation 
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 
APIs 
android.graphics.drawable. 
AnimationDrawable 
android.view.animation.* 
android.animation.* 
(2011/02) Animation in Honeycombhttp://android-developers.blogspot.kr/2011/02/animation-in-honeycomb.html 
(2011/05) Introducing ViewPropertyAnimatorhttp://android-developers.blogspot.kr/2011/05/introducing-viewpropertyanimator.html 
(2011/11) Android 4.0 Graphics and Animationshttp://android-developers.blogspot.kr/2011/11/android-40-graphics-and-animations.html 
Source: 13thKandroid MinMax–Silky Rendering Choreographer and Animation
Property Animation (Pre-Jellybean) 
Source: 13thKandroid MinMax–Silky Rendering Choreographer and Animation 
ValueAnimator 
doAnimationFrame() 
TimeInterpolatorgetInterpolation() 
Elapsed Fraction 
TypeEvaluator 
evaluate() 
Interpolated Fraction 
Current Value 
Frame Time 
( Frame Time –Start Time ) / Duration 
Math.pow( Elapsed Fraction, 2 Factor ) 
e.g., AccelerateInterpolator 
AnimatorUpdateListener 
onAimationUpdate() 
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 Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation 
③Garbage Collection Model 
Less 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
DalvikVM: Register-based 
※Stack, Accumulator, Register machine 
Stackmachine : 0-operand instruction set 
Accumulatormachine : 1-operand … 
Registermachine : 2 or 3-operand … 
000b: iload05 
000d: iload04 
000f: if_icmpge0024 
0012: aload_3 
0013: iload05 
0015: iaload 
0016: istore06 
0018: lload_1 
0019: iload06 
001b: i2l 
001c: ladd 
001d: lstore_1 
001e: iinc05, #+01 
0021: goto000b 
0007: if-gev0, 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: goto0007 
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 (inti: arr) { 
sum += i; 
} 
return sum; 
}
Just-In-Time Compiler (Froyo~) 
Source: Google I/O 2010 –A JIT Compiler for Android's DalvikVM
Just-In-Time Compiler (Froyo~) 
Source: Google I/O 2010 –A JIT Compiler for Android's DalvikVM 
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: 1stkandroidSeminar–DalvikVM 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: 1stkandroidSeminar–DalvikVM 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: 1stkandroidSeminar–DalvikVM 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: 1stkandroidSeminar–DalvikVM 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) AOThttp://www.mono-project.com/docs/advanced/aot/
Food for Further Review 
Comparison w/ Other Technology/Platforms 
•Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ 
•.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://en.wikipedia.org/wiki/Native_Image_Generator
Food for Further Review 
Comparison w/ Other Technology/Platforms 
•Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ 
•.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://en.wikipedia.org/wiki/Native_Image_Generator 
Implications to Application Developers
Food for Further Review 
Comparison w/ Other Technology/Platforms 
•Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ 
•.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://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) AOThttp://www.mono-project.com/docs/advanced/aot/ 
•.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://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) AOThttp://www.mono-project.com/docs/advanced/aot/ 
•.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://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 Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation 
③Garbage Collection Model 
Less and shorter pauses and less fragmentation
Changes in GC: WHY?
Changes in GC: WHY? 
192MBRAM320X480 
2008HTC G1
Changes in GC: WHY? 
1GBRAM 
1280X800 
2011 
Motorola Xoom 
192MBRAM320X480 
2008HTC G1
Changes in GC: WHY? 
1GBRAM 
1280X800 
2011 
Motorola Xoom 
192MBRAM320X480 
2008HTC G1 
2GB/3GBRAM 
2560X1440 
2014LG G3
Changes in GC: WHY? 
Bigger Heaps 
1GBRAM 
1280X800 
2011 
Motorola Xoom 
192MBRAM320X480 
2008HTC G1 
2GB/3GBRAM 
2560X1440 
2014LG G3
Changes in GC: WHY? 
Bigger Heaps 
Longer GC Pauses 
1GBRAM 
1280X800 
2011 
Motorola Xoom 
192MBRAM320X480 
2008HTC G1 
2GB/3GBRAM 
2560X1440 
2014LG G3
Changes in GC: WHY? 
Bigger Heaps 
Longer GC Pauses 
Poor UI Responsiveness 
1GBRAM 
1280X800 
2011 
Motorola Xoom 
192MBRAM320X480 
2008HTC G1 
2GB/3GBRAM 
2560X1440 
2014LG 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 pauseinstead of two 
•Parallelized processing during the remaining GC pause 
•Background stickyconcurrent mark sweep GC: Collector with lower pause time for the special case of cleaning up recently-allocated, short-livedobjects 
•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 pauseinstead of two 
•Parallelized processing during the remaining GC pause 
•Background stickyconcurrent mark sweep GC: Collector with lower pause time for the special case of cleaning up recently-allocated, short-livedobjects 
•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 pauseinstead of two 
•Parallelized processing during the remaining GC pause 
•Background stickyconcurrent mark sweep GC: Collector with lower pause time for the special case of cleaning up recently-allocated, short-livedobjects 
•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 Ergonomicshttp://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 Fragmentation 
Source: Google I/O 2014 –The ART runtime
Reducing Heap Fragmentation 
Source: 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 
Explicitconcurrent mark sweepGC 
freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, 
paused 1.195mstotal 87.219ms 
Backgroundpartialconcurrent mark sweepGC 
freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, 
paused 4.422mstotal 1.371747s 
Backgroundstickyconcurrent mark sweepGC 
freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, 
paused 6.139mstotal 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 
Explicitconcurrent mark sweepGC 
freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, 
paused 1.195mstotal 87.219ms 
Backgroundpartialconcurrent mark sweepGC 
freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, 
paused 4.422mstotal 1.371747s 
Backgroundstickyconcurrent mark sweepGC 
freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, 
paused 6.139mstotal 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 
Explicitconcurrent mark sweepGC 
freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, 
paused 1.195mstotal 87.219ms 
Backgroundpartialconcurrent mark sweepGC 
freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, 
paused 4.422mstotal 1.371747s 
Backgroundstickyconcurrent mark sweepGC 
freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, 
paused 6.139mstotal 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 
Explicitconcurrent mark sweepGC 
freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, 
paused 1.195mstotal 87.219ms 
Backgroundpartialconcurrent mark sweepGC 
freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, 
paused 4.422mstotal 1.371747s 
Backgroundstickyconcurrent mark sweepGC 
freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, 
paused 6.139mstotal 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 
Explicitconcurrent mark sweepGC 
freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, 
paused 1.195mstotal 87.219ms 
Backgroundpartialconcurrent mark sweepGC 
freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, 
paused 4.422mstotal 1.371747s 
Backgroundstickyconcurrent mark sweepGC 
freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, 
paused 6.139mstotal 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 Collectorhttp://www.mono-project.com/docs/advanced/garbage-collector/sgen/
Food for Further Review 
Comparison w/ Other Technology/Platforms 
•Mono: SGen Garbage Collectorhttp://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 Collectorhttp://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 Collectorhttp://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 Collectorhttp://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 Collectorhttp://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 Collectorhttp://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 Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation 
③Garbage Collection Model 
Less and shorter pauses and less fragmentation
Summary 
①UI Threading Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation 
③Garbage Collection Model 
Less and shorter pauses and less fragmentation 
(Software) Engineering is all about
Summary 
①UI Threading Model 
Single UI (Main) Thread UI & Render Thread 
②VM Execution Model 
Just-In-Time Compilation Ahead-Of-Time Compilation 
③Garbage Collection Model 
Less and shorter pauses and less fragmentation 
(Software) Engineering is all about 
TRADE-OFF!!!
Q&A 
THANK YOU

More Related Content

PDF
Automated Historical Performance Analysis with kmemtracer
PDF
Inside Android's Dalvik VM - NEJUG Nov 2011
PDF
Hierarchy Viewer Internals
PDF
Eric Lafortune - Fighting application size with ProGuard and beyond
PDF
OpenXR – State of the Union - Khronos GDC 2019
PDF
Getting Native with NDK
PPTX
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
PDF
Spring Performance Gains
Automated Historical Performance Analysis with kmemtracer
Inside Android's Dalvik VM - NEJUG Nov 2011
Hierarchy Viewer Internals
Eric Lafortune - Fighting application size with ProGuard and beyond
OpenXR – State of the Union - Khronos GDC 2019
Getting Native with NDK
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Spring Performance Gains

What's hot (20)

PDF
Guides To Analyzing WebKit Performance
PDF
Improve Android System Component Performance
PDF
Deep Learning Edge
PPTX
Using the android ndk - DroidCon Paris 2014
PDF
Android Native Development Kit
PDF
Practice of Android Reverse Engineering
PPT
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
PDF
Android ndk: Entering the native world
PPT
線上遊戲與雲端運算
PPTX
Reverse engineering android apps
PPT
Android - Api & Debugging in Android
PDF
Using the Android Native Development Kit (NDK)
PDF
Android IPC Mechanism
PPTX
Android ndk
PDF
RICOH THETA x IoT Developers Contest : Cloud API Seminar (2nd installation)
PPTX
Introduction to Module Development with Appcelerator Titanium
PDF
Using the Android Native Development Kit (NDK)
PDF
Cloud Deep Learning Chips Training & Inference
PDF
Toward dynamic analysis of obfuscated android malware
PPTX
Use Eclipse technologies to build a modern embedded IDE
Guides To Analyzing WebKit Performance
Improve Android System Component Performance
Deep Learning Edge
Using the android ndk - DroidCon Paris 2014
Android Native Development Kit
Practice of Android Reverse Engineering
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
Android ndk: Entering the native world
線上遊戲與雲端運算
Reverse engineering android apps
Android - Api & Debugging in Android
Using the Android Native Development Kit (NDK)
Android IPC Mechanism
Android ndk
RICOH THETA x IoT Developers Contest : Cloud API Seminar (2nd installation)
Introduction to Module Development with Appcelerator Titanium
Using the Android Native Development Kit (NDK)
Cloud Deep Learning Chips Training & Inference
Toward dynamic analysis of obfuscated android malware
Use Eclipse technologies to build a modern embedded IDE
Ad

Viewers also liked (13)

PPT
Introduction to Skia by Ryan Chou @20141008
PDF
A Detailed Look at Cairo's OpenGL Spans Compositor Performance
PDF
Skia & Freetype - Android 2D Graphics Essentials
PDF
LCE13: Android Graphics Upstreaming
PDF
Butter android views
ODP
Intentの概要
PDF
The Android graphics path, in depth
PDF
Android internals 07 - Android graphics (rev_1.1)
PDF
Hardware Accelerated 2D Rendering for Android
PDF
Understanding the Dalvik Virtual Machine
PDF
Design and Concepts of Android Graphics
PDF
Mobile Browser Internal (Blink Rendering Engine)
PDF
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
Introduction to Skia by Ryan Chou @20141008
A Detailed Look at Cairo's OpenGL Spans Compositor Performance
Skia & Freetype - Android 2D Graphics Essentials
LCE13: Android Graphics Upstreaming
Butter android views
Intentの概要
The Android graphics path, in depth
Android internals 07 - Android graphics (rev_1.1)
Hardware Accelerated 2D Rendering for Android
Understanding the Dalvik Virtual Machine
Design and Concepts of Android Graphics
Mobile Browser Internal (Blink Rendering Engine)
React Nativeはクロスプラットフォームモバイルアプリ開発の夢を見るか #DroidKaigi
Ad

Similar to [1D6]RE-view of Android L developer PRE-view (20)

PDF
Graphicsand animations devoxx2010 (1)
PPTX
Advanced #4 GPU & Animations
PDF
Android UI Tips, Tricks and Techniques
PDF
Android UI Development: Tips, Tricks, and Techniques
PPT
Why your Android Apps Suck
PDF
Inside Android's UI / ABS 2013
PDF
Abc2011 yagi
PDF
Inside Android's UI
PDF
Android 3.0 Portland Java User Group 2011-03-15
PPT
android-tutorial-for-beginner
PDF
Android development first steps
PDF
Android - Open Source Bridge 2011
PDF
Ask the expert - App performance on Series 40 phones
PPTX
Android apps development
PDF
Facets Of Fragmentation by Mark Murphy
PPTX
Beginning android games
PDF
Inside Android's UI at AnDevCon V
PPT
Android UI
PPT
Android Ui
PDF
Android Development
Graphicsand animations devoxx2010 (1)
Advanced #4 GPU & Animations
Android UI Tips, Tricks and Techniques
Android UI Development: Tips, Tricks, and Techniques
Why your Android Apps Suck
Inside Android's UI / ABS 2013
Abc2011 yagi
Inside Android's UI
Android 3.0 Portland Java User Group 2011-03-15
android-tutorial-for-beginner
Android development first steps
Android - Open Source Bridge 2011
Ask the expert - App performance on Series 40 phones
Android apps development
Facets Of Fragmentation by Mark Murphy
Beginning android games
Inside Android's UI at AnDevCon V
Android UI
Android Ui
Android Development

More from NAVER D2 (20)

PDF
[211] 인공지능이 인공지능 챗봇을 만든다
PDF
[233] 대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing: Maglev Hashing Scheduler i...
PDF
[215] Druid로 쉽고 빠르게 데이터 분석하기
PDF
[245]Papago Internals: 모델분석과 응용기술 개발
PDF
[236] 스트림 저장소 최적화 이야기: 아파치 드루이드로부터 얻은 교훈
PDF
[235]Wikipedia-scale Q&A
PDF
[244]로봇이 현실 세계에 대해 학습하도록 만들기
PDF
[243] Deep Learning to help student’s Deep Learning
PDF
[234]Fast & Accurate Data Annotation Pipeline for AI applications
PDF
Old version: [233]대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing
PDF
[226]NAVER 광고 deep click prediction: 모델링부터 서빙까지
PDF
[225]NSML: 머신러닝 플랫폼 서비스하기 & 모델 튜닝 자동화하기
PDF
[224]네이버 검색과 개인화
PDF
[216]Search Reliability Engineering (부제: 지진에도 흔들리지 않는 네이버 검색시스템)
PDF
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
PDF
[213] Fashion Visual Search
PDF
[232] TensorRT를 활용한 딥러닝 Inference 최적화
PDF
[242]컴퓨터 비전을 이용한 실내 지도 자동 업데이트 방법: 딥러닝을 통한 POI 변화 탐지
PDF
[212]C3, 데이터 처리에서 서빙까지 가능한 하둡 클러스터
PDF
[223]기계독해 QA: 검색인가, NLP인가?
[211] 인공지능이 인공지능 챗봇을 만든다
[233] 대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing: Maglev Hashing Scheduler i...
[215] Druid로 쉽고 빠르게 데이터 분석하기
[245]Papago Internals: 모델분석과 응용기술 개발
[236] 스트림 저장소 최적화 이야기: 아파치 드루이드로부터 얻은 교훈
[235]Wikipedia-scale Q&A
[244]로봇이 현실 세계에 대해 학습하도록 만들기
[243] Deep Learning to help student’s Deep Learning
[234]Fast & Accurate Data Annotation Pipeline for AI applications
Old version: [233]대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing
[226]NAVER 광고 deep click prediction: 모델링부터 서빙까지
[225]NSML: 머신러닝 플랫폼 서비스하기 & 모델 튜닝 자동화하기
[224]네이버 검색과 개인화
[216]Search Reliability Engineering (부제: 지진에도 흔들리지 않는 네이버 검색시스템)
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
[213] Fashion Visual Search
[232] TensorRT를 활용한 딥러닝 Inference 최적화
[242]컴퓨터 비전을 이용한 실내 지도 자동 업데이트 방법: 딥러닝을 통한 POI 변화 탐지
[212]C3, 데이터 처리에서 서빙까지 가능한 하둡 클러스터
[223]기계독해 QA: 검색인가, NLP인가?

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Encapsulation theory and applications.pdf
Understanding_Digital_Forensics_Presentation.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Building Integrated photovoltaic BIPV_UPV.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
Spectral efficient network and resource selection model in 5G networks
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
Empathic Computing: Creating Shared Understanding
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Monthly Chronicles - July 2025
Encapsulation theory and applications.pdf

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

  • 5. 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 Motionprovides meaning Principles http://www.google.com/design/spec/material-design/introduction.html
  • 6. Android Runtime https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/
  • 7. Android Runtime https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/ Dalvikis dead, long live Dalvik! DO NOT MERGE
  • 8. Android Runtime https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/ Dalvikis dead, long live Dalvik! DO NOT MERGE
  • 9. Android Runtime https://android-review.googlesource.com/#/c/98553/ https://android-review.googlesource.com/#/c/98374/ Dalvikis dead, long live Dalvik! DO NOT MERGE
  • 11. Key Architectural Changes in L ①UI Threading Model Single UI (Main) Thread UI & Render Thread
  • 12. Key Architectural Changes in L ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation
  • 13. Key Architectural Changes in L ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation ③Garbage Collection Model Less and shorter pauses and less fragmentation
  • 14. Agenda ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation ③Garbage Collection Model Less and shorter pauses and less fragmentation
  • 15. Render Thread in L http://www.youtube.com/watch?v=3TtVsy98ces ① ① ②
  • 16. Render Thread in L http://www.youtube.com/watch?v=3TtVsy98ces ②
  • 17. Render Thread in L http://www.youtube.com/watch?v=3TtVsy98ces
  • 18. Render Thread in L http://www.youtube.com/watch?v=3TtVsy98ces One of the most exciting topics that was glossed over was the introduction of a dedicatedrender thread. The goal of the render threadis to take many of the atomic animationsintroduced with material designand 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/
  • 19. UI (Main) Thread Activity ThreadHelloAndroid.apk Activity 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 Views Views Views Application Instrumentation test.apk Test Case
  • 20. Looper, Message Queue, and Handler
  • 21. GPUI -UI on the GPU (Honeycomb~) Source: Google I/O 2011 –Accelerated Android Rendering
  • 22. GPUI -UI on the GPU (Honeycomb~) Source: Google I/O 2011 –Accelerated Android Rendering CPU Rasterization GPU Composition
  • 23. GPUI -UI on the GPU (Honeycomb~) Increased Number of Pixels Source: Google I/O 2011 –Accelerated Android Rendering CPU Rasterization GPU Composition
  • 24. GPUI -UI on the GPU (Honeycomb~) Increased Number of Pixels Source: Google I/O 2011 –Accelerated Android Rendering CPU Rasterization GPU Composition GPU RasterizationGPU Composition
  • 25. 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 RasterizationGPU Composition
  • 26. Display List A 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>> +Sav e +Restore +RestoreToCount +Sav eLayer +Sav eLayerAlpha +Translate +Rotate +Scale +Skew +SetMatrix +ConcatMatrix +ClipRect DisplayList::Op[Drawing] <<enumeration>> +DrawDisplayList +DrawLayer +DrawBitmap +DrawBitmapMatrix +DrawBitmapRect +DrawBitmapData +DrawBitmapMesh +DrawPatch +DrawColor +DrawRect +DrawRoundRect +DrawCircle +DrawOv al +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
  • 27. Display List A 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>> +Sav e +Restore +RestoreToCount +Sav eLayer +Sav eLayerAlpha +Translate +Rotate +Scale +Skew +SetMatrix +ConcatMatrix +ClipRect DisplayList::Op[Drawing] <<enumeration>> +DrawDisplayList +DrawLayer +DrawBitmap +DrawBitmapMatrix +DrawBitmapRect +DrawBitmapData +DrawBitmapMesh +DrawPatch +DrawColor +DrawRect +DrawRoundRect +DrawCircle +DrawOv al +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
  • 28. Display List: An Example DrawDisplayList DrawPatch Save Translate ConcatMatrix DrawBitmap RestoreToCount $ adbshell dumpsysgfxinfo[pid|pname] JB (API Level 18) Source: 12thKandroid Conference –Terminology and History of Android Performance Features
  • 29. Android Animation DrawableAnimation 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 APIs android.graphics.drawable. AnimationDrawable android.view.animation.* android.animation.* (2011/02) Animation in Honeycombhttp://android-developers.blogspot.kr/2011/02/animation-in-honeycomb.html (2011/05) Introducing ViewPropertyAnimatorhttp://android-developers.blogspot.kr/2011/05/introducing-viewpropertyanimator.html (2011/11) Android 4.0 Graphics and Animationshttp://android-developers.blogspot.kr/2011/11/android-40-graphics-and-animations.html Source: 13thKandroid MinMax–Silky Rendering Choreographer and Animation
  • 30. Property Animation (Pre-Jellybean) Source: 13thKandroid MinMax–Silky Rendering Choreographer and Animation ValueAnimator doAnimationFrame() TimeInterpolatorgetInterpolation() Elapsed Fraction TypeEvaluator evaluate() Interpolated Fraction Current Value Frame Time ( Frame Time –Start Time ) / Duration Math.pow( Elapsed Fraction, 2 Factor ) e.g., AccelerateInterpolator AnimatorUpdateListener onAimationUpdate() 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
  • 31. 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
  • 32. 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
  • 33. Threads in Action Threads in KitKat
  • 34. Threads in Action Threads in KitKat
  • 35. Threads in Action Threads in KitKat Threads in L
  • 36. Threads in Action Threads in KitKat Threads in L
  • 38. Food for Further Review Comparison w/ Other Technology/Platforms
  • 39. 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
  • 40. 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/
  • 41. 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
  • 42. 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?
  • 43. Agenda ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation ③Garbage Collection Model Less and shorter pauses and less fragmentation
  • 45. “Can u guys add some performance boosting thing on the next version” Performance Boosting Thing
  • 46. “Can u guys add some performance boosting thing on the next version” Performance Boosting Thing
  • 47. “Can u guys add some performance boosting thing on the next version” Performance Boosting Thing
  • 48. “Can u guys add some performance boosting thing on the next version” Performance Boosting Thing
  • 49. PBT == ART Source: Google I/O 2014 –The ART Runtime
  • 50. PBT == ART Ahead-Of-Time (AOT) Source: Google I/O 2014 –The ART Runtime
  • 51. PBT == ART Ahead-Of-Time (AOT) Garbage Collection Source: Google I/O 2014 –The ART Runtime
  • 52. PBT == ART Ahead-Of-Time (AOT) Garbage Collection 64-bit Support Source: Google I/O 2014 –The ART Runtime
  • 53. DalvikVM: Register-based ※Stack, Accumulator, Register machine Stackmachine : 0-operand instruction set Accumulatormachine : 1-operand … Registermachine : 2 or 3-operand … 000b: iload05 000d: iload04 000f: if_icmpge0024 0012: aload_3 0013: iload05 0015: iaload 0016: istore06 0018: lload_1 0019: iload06 001b: i2l 001c: ladd 001d: lstore_1 001e: iinc05, #+01 0021: goto000b 0007: if-gev0, 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: goto0007 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 (inti: arr) { sum += i; } return sum; }
  • 54. Just-In-Time Compiler (Froyo~) Source: Google I/O 2010 –A JIT Compiler for Android's DalvikVM
  • 55. Just-In-Time Compiler (Froyo~) Source: Google I/O 2010 –A JIT Compiler for Android's DalvikVM When to Compile? What to Compile?
  • 56. AOT Compiler (L~) Source: Google I/O 2014 –The ART Runtime
  • 57. AOT Compiler (L~) When to Compile? What to Compile? Source: Google I/O 2014 –The ART Runtime
  • 58. .art / .oat / .odex Source: Google I/O 2014 –The ART Runtime
  • 59. AOT in Action ~ ~ ~
  • 60. AOT in Action ~ ~ ~
  • 61. AOT in Action ~ ~ ~
  • 62. AOT in Action ~ ~ ~
  • 63. AOT in Action ~ ~ ~
  • 64. 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: 1stkandroidSeminar–DalvikVM vs. Java VM (류혁곤님발표)
  • 65. 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: 1stkandroidSeminar–DalvikVM vs. Java VM (류혁곤님발표) Speed/Space
  • 66. 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: 1stkandroidSeminar–DalvikVM vs. Java VM (류혁곤님발표) Optimization Window Speed/Space
  • 67. 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: 1stkandroidSeminar–DalvikVM vs. Java VM (류혁곤님발표) Optimization Window Memory Sharing Speed/Space
  • 69. Food for Further Review Comparison w/ Other Technology/Platforms
  • 70. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/
  • 71. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ •.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://en.wikipedia.org/wiki/Native_Image_Generator
  • 72. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ •.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://en.wikipedia.org/wiki/Native_Image_Generator Implications to Application Developers
  • 73. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ •.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://en.wikipedia.org/wiki/Native_Image_Generator Implications to Application Developers •Getter/Setter vs. Direct Access to Field?
  • 74. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ •.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://en.wikipedia.org/wiki/Native_Image_Generator Implications to Application Developers •Getter/Setter vs. Direct Access to Field? •Small vs. Large Method?
  • 75. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: JIT and (Full) AOThttp://www.mono-project.com/docs/advanced/aot/ •.NET: NGenhttp://blogs.msdn.com/b/clrcodegeneration/archive/2010/04/27/ngen-walk-through-series.aspxhttp://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++?
  • 76. Agenda ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation ③Garbage Collection Model Less and shorter pauses and less fragmentation
  • 78. Changes in GC: WHY? 192MBRAM320X480 2008HTC G1
  • 79. Changes in GC: WHY? 1GBRAM 1280X800 2011 Motorola Xoom 192MBRAM320X480 2008HTC G1
  • 80. Changes in GC: WHY? 1GBRAM 1280X800 2011 Motorola Xoom 192MBRAM320X480 2008HTC G1 2GB/3GBRAM 2560X1440 2014LG G3
  • 81. Changes in GC: WHY? Bigger Heaps 1GBRAM 1280X800 2011 Motorola Xoom 192MBRAM320X480 2008HTC G1 2GB/3GBRAM 2560X1440 2014LG G3
  • 82. Changes in GC: WHY? Bigger Heaps Longer GC Pauses 1GBRAM 1280X800 2011 Motorola Xoom 192MBRAM320X480 2008HTC G1 2GB/3GBRAM 2560X1440 2014LG G3
  • 83. Changes in GC: WHY? Bigger Heaps Longer GC Pauses Poor UI Responsiveness 1GBRAM 1280X800 2011 Motorola Xoom 192MBRAM320X480 2008HTC G1 2GB/3GBRAM 2560X1440 2014LG G3
  • 84. Changes in GC: WHAT?
  • 85. 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
  • 86. 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
  • 87. 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
  • 88. Changes in GC: WHAT? L and Beyond •One GC pauseinstead of two •Parallelized processing during the remaining GC pause •Background stickyconcurrent mark sweep GC: Collector with lower pause time for the special case of cleaning up recently-allocated, short-livedobjects •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)
  • 89. Changes in GC: WHAT? L and Beyond •One GC pauseinstead of two •Parallelized processing during the remaining GC pause •Background stickyconcurrent mark sweep GC: Collector with lower pause time for the special case of cleaning up recently-allocated, short-livedobjects •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] (학문명백과: 공학, 형설출판사)
  • 90. Changes in GC: WHAT? L and Beyond •One GC pauseinstead of two •Parallelized processing during the remaining GC pause •Background stickyconcurrent mark sweep GC: Collector with lower pause time for the special case of cleaning up recently-allocated, short-livedobjects •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 Ergonomicshttp://docs.oracle.com/javase/7/docs/technotes/ guides/vm/gc-ergonomics.html
  • 91. Two Pauses One Pause Source: Google I/O 2014 –The ART runtime
  • 92. Two Pauses One Pause Source: Google I/O 2014 –The ART runtime
  • 93. Two Pauses One Pause Source: Google I/O 2014 –The ART runtime
  • 94. Long Pause for GC_FOR_ALLOC Source: Google I/O 2014 –The ART runtime
  • 95. Long Pause for GC_FOR_ALLOC Source: Google I/O 2014 –The ART runtime
  • 96. Reducing Heap Fragmentation Source: Google I/O 2014 –The ART runtime
  • 97. Reducing Heap Fragmentation Source: Google I/O 2014 –The ART runtime
  • 98. 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 Explicitconcurrent mark sweepGC freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, paused 1.195mstotal 87.219ms Backgroundpartialconcurrent mark sweepGC freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, paused 4.422mstotal 1.371747s Backgroundstickyconcurrent mark sweepGC freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, paused 6.139mstotal 52.868ms Source : http://www.anandtech.com/show/8231/a-closer-look-at-android-runtime-art-in-android-l/2
  • 99. 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 Explicitconcurrent mark sweepGC freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, paused 1.195mstotal 87.219ms Backgroundpartialconcurrent mark sweepGC freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, paused 4.422mstotal 1.371747s Backgroundstickyconcurrent mark sweepGC freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, paused 6.139mstotal 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
  • 100. 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 Explicitconcurrent mark sweepGC freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, paused 1.195mstotal 87.219ms Backgroundpartialconcurrent mark sweepGC freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, paused 4.422mstotal 1.371747s Backgroundstickyconcurrent mark sweepGC freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, paused 6.139mstotal 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
  • 101. 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 Explicitconcurrent mark sweepGC freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, paused 1.195mstotal 87.219ms Backgroundpartialconcurrent mark sweepGC freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, paused 4.422mstotal 1.371747s Backgroundstickyconcurrent mark sweepGC freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, paused 6.139mstotal 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
  • 102. 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 Explicitconcurrent mark sweepGC freed 65595(3MB) AllocSpaceobjects, 9(4MB) LOS objects, 810% free, 38MB/58MB, paused 1.195mstotal 87.219ms Backgroundpartialconcurrent mark sweepGC freed 74626(3MB) AllocSpaceobjects, 39(4MB) LOS objects, 1496% free, 25MB/32MB, paused 4.422mstotal 1.371747s Backgroundstickyconcurrent mark sweepGC freed 70319(3MB) AllocSpaceobjects, 59(5MB) LOS objects, 825% free, 49MB/56MB, paused 6.139mstotal 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
  • 103. Food for Further Review
  • 104. Food for Further Review Comparison w/ Other Technology/Platforms
  • 105. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: SGen Garbage Collectorhttp://www.mono-project.com/docs/advanced/garbage-collector/sgen/
  • 106. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: SGen Garbage Collectorhttp://www.mono-project.com/docs/advanced/garbage-collector/sgen/ •V8: Stop-the-world, Generational, Accurate Garbage Collectorhttps://developers.google.com/v8/design#garb_coll
  • 107. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: SGen Garbage Collectorhttp://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
  • 108. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: SGen Garbage Collectorhttp://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
  • 109. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: SGen Garbage Collectorhttp://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?
  • 110. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: SGen Garbage Collectorhttp://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()?
  • 111. Food for Further Review Comparison w/ Other Technology/Platforms •Mono: SGen Garbage Collectorhttp://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
  • 112. Summary ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation ③Garbage Collection Model Less and shorter pauses and less fragmentation
  • 113. Summary ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation ③Garbage Collection Model Less and shorter pauses and less fragmentation (Software) Engineering is all about
  • 114. Summary ①UI Threading Model Single UI (Main) Thread UI & Render Thread ②VM Execution Model Just-In-Time Compilation Ahead-Of-Time Compilation ③Garbage Collection Model Less and shorter pauses and less fragmentation (Software) Engineering is all about TRADE-OFF!!!