[1d6]re-view of android l developer pre-view
DESCRIPTION
DEVIEW 2014 [1D6]RE-view of Android L developer PRE-viewTRANSCRIPT
![Page 1: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/1.jpg)
이경민
LG전자
RE-view of
Android L Developer
PRE-view
![Page 5: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/5.jpg)
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
![Page 6: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/6.jpg)
Android Runtimehttps://android-review.googlesource.com/#/c/98553/
https://android-review.googlesource.com/#/c/98374/
![Page 7: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/7.jpg)
Android Runtimehttps://android-review.googlesource.com/#/c/98553/
https://android-review.googlesource.com/#/c/98374/
Dalvik is dead, long live Dalvik! DO NOT MERGE
![Page 8: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/8.jpg)
Android Runtimehttps://android-review.googlesource.com/#/c/98553/
https://android-review.googlesource.com/#/c/98374/
Dalvik is dead, long live Dalvik! DO NOT MERGE
![Page 9: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/9.jpg)
Android Runtimehttps://android-review.googlesource.com/#/c/98553/
https://android-review.googlesource.com/#/c/98374/
Dalvik is dead, long live Dalvik! DO NOT MERGE
![Page 10: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/10.jpg)
Key Architectural Changes in L
![Page 11: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/11.jpg)
Key Architectural Changes in L
① UI Threading ModelSingle UI (Main) Thread UI & Render Thread
![Page 12: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/12.jpg)
Key Architectural Changes in L
① UI Threading ModelSingle UI (Main) Thread UI & Render Thread
② VM Execution ModelJust-In-Time Compilation Ahead-Of-Time Compilation
![Page 13: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/13.jpg)
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
![Page 14: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/14.jpg)
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
![Page 15: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/15.jpg)
Render Thread in Lhttp://www.youtube.com/watch?v=3TtVsy98ces
①①
②
![Page 16: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/16.jpg)
Render Thread in Lhttp://www.youtube.com/watch?v=3TtVsy98ces
②
![Page 17: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/17.jpg)
Render Thread in Lhttp://www.youtube.com/watch?v=3TtVsy98ces
![Page 18: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/18.jpg)
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/
![Page 19: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/19.jpg)
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
![Page 20: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/20.jpg)
Looper, Message Queue, and Handler
![Page 21: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/21.jpg)
GPUI - UI on the GPU (Honeycomb~)
Source: Google I/O 2011 – Accelerated Android Rendering
![Page 22: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/22.jpg)
GPUI - UI on the GPU (Honeycomb~)
Source: Google I/O 2011 – Accelerated Android Rendering
CPU Rasterization
GPU Composition
![Page 23: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/23.jpg)
GPUI - UI on the GPU (Honeycomb~)
Increased
Number of
Pixels
Source: Google I/O 2011 – Accelerated Android Rendering
CPU Rasterization
GPU Composition
![Page 24: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/24.jpg)
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
![Page 25: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/25.jpg)
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
![Page 26: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/26.jpg)
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
![Page 27: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/27.jpg)
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
![Page 28: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/28.jpg)
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
![Page 29: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/29.jpg)
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
![Page 30: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/30.jpg)
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
![Page 31: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/31.jpg)
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
![Page 32: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/32.jpg)
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
![Page 33: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/33.jpg)
Threads in Action
Threads in KitKat
![Page 34: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/34.jpg)
Threads in Action
Threads in KitKat
![Page 35: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/35.jpg)
Threads in Action
Threads in KitKat Threads in L
![Page 36: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/36.jpg)
Threads in Action
Threads in KitKat Threads in L
![Page 37: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/37.jpg)
Food for Further Review
![Page 38: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/38.jpg)
Food for Further Review
Comparison w/ Other Technology/Platforms
![Page 39: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/39.jpg)
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
![Page 40: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/40.jpg)
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/
![Page 41: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/41.jpg)
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
![Page 42: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/42.jpg)
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?
![Page 43: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/43.jpg)
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
![Page 44: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/44.jpg)
Performance Boosting Thing
![Page 45: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/45.jpg)
“Can u guys add some performance
boosting thing on the next version”
Performance Boosting Thing
![Page 46: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/46.jpg)
“Can u guys add some performance
boosting thing on the next version”
Performance Boosting Thing
![Page 47: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/47.jpg)
“Can u guys add some performance
boosting thing on the next version”
Performance Boosting Thing
![Page 48: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/48.jpg)
“Can u guys add some performance
boosting thing on the next version”
Performance Boosting Thing
![Page 49: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/49.jpg)
PBT == ART
Source: Google I/O 2014 – The ART Runtime
![Page 50: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/50.jpg)
PBT == ART
Ahead-Of-Time (AOT)
Source: Google I/O 2014 – The ART Runtime
![Page 51: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/51.jpg)
PBT == ART
Ahead-Of-Time (AOT)
Garbage Collection
Source: Google I/O 2014 – The ART Runtime
![Page 52: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/52.jpg)
PBT == ART
Ahead-Of-Time (AOT)
Garbage Collection
64-bit Support
Source: Google I/O 2014 – The ART Runtime
![Page 53: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/53.jpg)
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;
}
![Page 54: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/54.jpg)
Just-In-Time Compiler (Froyo~)
Source: Google I/O 2010 – A JIT Compiler for Android's Dalvik VM
![Page 55: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/55.jpg)
Just-In-Time Compiler (Froyo~)
Source: Google I/O 2010 – A JIT Compiler for Android's Dalvik VM
When to Compile?
What to Compile?
![Page 56: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/56.jpg)
AOT Compiler (L~)
Source: Google I/O 2014 – The ART Runtime
![Page 57: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/57.jpg)
AOT Compiler (L~)
When to Compile?
What to Compile?
Source: Google I/O 2014 – The ART Runtime
![Page 58: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/58.jpg)
.art / .oat / .odex
Source: Google I/O 2014 – The ART Runtime
![Page 59: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/59.jpg)
AOT in Action
~~
~
![Page 60: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/60.jpg)
AOT in Action
~~
~
![Page 61: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/61.jpg)
AOT in Action
~~
~
![Page 62: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/62.jpg)
AOT in Action
~~
~
![Page 63: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/63.jpg)
AOT in Action
~~
~
![Page 64: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/64.jpg)
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 (류혁곤 님 발표)
![Page 65: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/65.jpg)
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
![Page 66: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/66.jpg)
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
![Page 67: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/67.jpg)
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
![Page 68: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/68.jpg)
Food for Further Review
![Page 69: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/69.jpg)
Food for Further Review
Comparison w/ Other Technology/Platforms
![Page 70: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/70.jpg)
Food for Further Review
Comparison w/ Other Technology/Platforms• Mono: JIT and (Full) AOT
http://www.mono-project.com/docs/advanced/aot/
![Page 71: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/71.jpg)
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
![Page 72: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/72.jpg)
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
![Page 73: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/73.jpg)
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?
![Page 74: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/74.jpg)
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?
![Page 75: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/75.jpg)
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++?
![Page 76: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/76.jpg)
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
![Page 77: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/77.jpg)
Changes in GC: WHY?
![Page 78: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/78.jpg)
Changes in GC: WHY?
192MB RAM
320X480
2008
HTC G1
![Page 79: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/79.jpg)
Changes in GC: WHY?
1GB RAM
1280X800
2011
Motorola Xoom
192MB RAM
320X480
2008
HTC G1
![Page 80: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/80.jpg)
Changes in GC: WHY?
1GB RAM
1280X800
2011
Motorola Xoom
192MB RAM
320X480
2008
HTC G1
2GB/3GB RAM
2560X1440
2014
LG G3
![Page 81: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/81.jpg)
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
![Page 82: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/82.jpg)
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
![Page 83: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/83.jpg)
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
![Page 84: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/84.jpg)
Changes in GC: WHAT?
![Page 85: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/85.jpg)
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
![Page 86: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/86.jpg)
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
![Page 87: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/87.jpg)
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
![Page 88: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/88.jpg)
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)
![Page 89: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/89.jpg)
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](학문명백과 : 공학, 형설출판사)
![Page 90: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/90.jpg)
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
![Page 91: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/91.jpg)
Two Pauses One Pause
Source: Google I/O 2014 – The ART runtime
![Page 92: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/92.jpg)
Two Pauses One Pause
Source: Google I/O 2014 – The ART runtime
![Page 93: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/93.jpg)
Two Pauses One Pause
Source: Google I/O 2014 – The ART runtime
![Page 94: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/94.jpg)
Long Pause for GC_FOR_ALLOC
Source: Google I/O 2014 – The ART runtime
![Page 95: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/95.jpg)
Long Pause for GC_FOR_ALLOC
Source: Google I/O 2014 – The ART runtime
![Page 96: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/96.jpg)
Reducing Heap FragmentationSource: Google I/O 2014 – The ART runtime
![Page 97: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/97.jpg)
Reducing Heap FragmentationSource: Google I/O 2014 – The ART runtime
![Page 98: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/98.jpg)
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
![Page 99: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/99.jpg)
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
![Page 100: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/100.jpg)
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
![Page 101: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/101.jpg)
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
![Page 102: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/102.jpg)
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
![Page 103: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/103.jpg)
Food for Further Review
![Page 104: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/104.jpg)
Food for Further Review
Comparison w/ Other Technology/Platforms
![Page 105: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/105.jpg)
Food for Further Review
Comparison w/ Other Technology/Platforms• Mono: SGen Garbage Collector
http://www.mono-project.com/docs/advanced/garbage-collector/sgen/
![Page 106: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/106.jpg)
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
![Page 107: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/107.jpg)
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
![Page 108: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/108.jpg)
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
![Page 109: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/109.jpg)
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?
![Page 110: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/110.jpg)
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()?
![Page 111: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/111.jpg)
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
![Page 112: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/112.jpg)
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
![Page 113: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/113.jpg)
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
![Page 114: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/114.jpg)
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!!!
![Page 115: [1D6]RE-view of Android L developer PRE-view](https://reader034.vdocuments.site/reader034/viewer/2022051313/547e8772b479597f508b4b62/html5/thumbnails/115.jpg)
Q&A
THANK YOU